]> granicus.if.org Git - php/commitdiff
handled NetWare F_SETFD and stat differences
authorAnantha Kesari H Y <hyanantha@php.net>
Thu, 30 Sep 2004 14:23:51 +0000 (14:23 +0000)
committerAnantha Kesari H Y <hyanantha@php.net>
Thu, 30 Sep 2004 14:23:51 +0000 (14:23 +0000)
ext/session/mod_files.c

index adcb476f6ef2c9a12b2167f854fb7165206379c3..75ccaaf97d75e3f9b4142d19329d1de1972f4dc3 100644 (file)
@@ -166,7 +166,12 @@ static void ps_files_open(ps_files *data, const char *key TSRMLS_DC)
                        flock(data->fd, LOCK_EX);
 
 #ifdef F_SETFD
+#ifdef NETWARE
+       /* NetWare LibC returns -1 upon error and upon success it returns non-zero unlike zero in other OSes*/
+                       if (fcntl(data->fd, F_SETFD, 1) == -1) {
+#else
                        if (fcntl(data->fd, F_SETFD, 1)) {
+#endif
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "fcntl(%d, F_SETFD, 1) failed: %s (%d)", data->fd, strerror(errno), errno);
                        }
 #endif
@@ -216,7 +221,11 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC)
                                buf[dirname_len + entry_len + 1] = '\0';
                                /* check whether its last access was more than maxlifet ago */
                                if (VCWD_STAT(buf, &sbuf) == 0 && 
+#ifdef NETWARE
+                                               (now - sbuf.st_mtime.tv_sec) > maxlifetime) {
+#else
                                                (now - sbuf.st_mtime) > maxlifetime) {
+#endif
                                        VCWD_UNLINK(buf);
                                        nrdels++;
                                }