From: Yasuo Ohgaki Date: Mon, 29 Apr 2002 09:43:48 +0000 (+0000) Subject: MFH touch bag fix X-Git-Tag: php-4.2.1RC1~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=18e00ac0a3cabfeb99ae7d92176e73329b3e6c74;p=php MFH touch bag fix --- diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index c74355dd80..a330877a6d 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -475,7 +475,7 @@ PHP_FUNCTION(touch) struct stat sb; FILE *file; struct utimbuf newtimebuf; - struct utimbuf *newtime = &newtimebuf; + struct utimbuf *newtime = NULL; int ac = ZEND_NUM_ARGS(); if (ac == 1 && zend_get_parameters_ex(1, &filename) != FAILURE) { @@ -483,9 +483,12 @@ PHP_FUNCTION(touch) newtime->modtime = newtime->actime = time(NULL); #endif } else if (ac == 2 && zend_get_parameters_ex(2, &filename, &filetime) != FAILURE) { + newtime = &newtimebuf; convert_to_long_ex(filetime); + newtime->actime = time(NULL); newtime->modtime = newtime->actime = Z_LVAL_PP(filetime); } else if (ac == 3 && zend_get_parameters_ex(3, &filename, &filetime, &fileatime) != FAILURE) { + newtime = &newtimebuf; convert_to_long_ex(fileatime); convert_to_long_ex(filetime); newtime->actime = Z_LVAL_PP(fileatime); @@ -519,9 +522,8 @@ PHP_FUNCTION(touch) if (ret == -1) { php_error(E_WARNING, "utime failed: %s", strerror(errno)); RETURN_FALSE; - } else { - RETURN_TRUE; } + RETURN_TRUE; #endif } /* }}} */