cvs: php4 /main reentrancy.c

From: Date: Fri, 27 Apr 2001 11:14:50 +0000
Subject: cvs: php4 /main reentrancy.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5312@lists.php.net to get a copy of this message
sas Fri Apr 27 04:14:50 2001 EDT Modified files: /php4/main reentrancy.c Log: Make old readdir_r code compatible with HPUX and Solaris. Index: php4/main/reentrancy.c diff -u php4/main/reentrancy.c:1.26 php4/main/reentrancy.c:1.27 --- php4/main/reentrancy.c:1.26 Tue Mar 13 03:09:37 2001 +++ php4/main/reentrancy.c Fri Apr 27 04:14:48 2001 @@ -99,20 +99,22 @@ struct dirent **result) { #if defined(HAVE_OLD_READDIR_R) - int ret; + int ret = 0; - errno = 0; - - ret = readdir_r(dirp, entry); - - if (!ret || errno != 0) { + /* We cannot rely on the return value of readdir_r + as it differs between various platforms + (HPUX returns 0 on success whereas Solaris returns non-zero) + */ + entry->d_name[0] = '\0'; + readdir_r(dirp, entry); + + if (entry->d_name[0] == '\0') { *result = NULL; + ret = errno; } else { *result = entry; } - - return errno; - + return ret; #else struct dirent *ptr; int ret = 0;

« previous php.cvs (#5312) next »