svn commit: samba r7246 - in trunk/source/libsmb: .

derrell at samba.org derrell at samba.org
Fri Jun 3 18:55:41 GMT 2005


Author: derrell
Date: 2005-06-03 18:55:40 +0000 (Fri, 03 Jun 2005)
New Revision: 7246

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7246

Log:
bug fixes in libsmbclient, setting time attributes
Modified:
   trunk/source/libsmb/libsmbclient.c


Changeset:
Modified: trunk/source/libsmb/libsmbclient.c
===================================================================
--- trunk/source/libsmb/libsmbclient.c	2005-06-03 18:54:32 UTC (rev 7245)
+++ trunk/source/libsmb/libsmbclient.c	2005-06-03 18:55:40 UTC (rev 7246)
@@ -1240,13 +1240,22 @@
          * Get the create time of the file (if not provided); we'll need it in
          * the set call.
          */
-        if (! srv->no_pathinfo && c_time != 0) {
+        if (! srv->no_pathinfo && c_time == 0) {
                 if (! cli_qpathinfo(&srv->cli, path,
                                     &c_time, NULL, NULL, NULL, NULL)) {
                         /* qpathinfo not available */
                         srv->no_pathinfo = True;
                 } else {
                         /*
+                         * We got a creation time.  Some OS versions don't
+                         * return a valid create time, though.  If we got an
+                         * invalid time, start with the current time instead.
+                         */
+                        if (c_time == 0 || c_time == (time_t) -1) {
+                                c_time = time(NULL);
+                        }
+
+                        /*
                          * We got a creation time.  For sanity sake, since
                          * there is no POSIX function to set the create time
                          * of a file, if the existing create time is greater
@@ -1304,7 +1313,7 @@
                 /* If we got create time, set times */
                 if (ret) {
                         /* Some OS versions don't support create time */
-                        if (c_time == 0) {
+                        if (c_time == 0 || c_time == -1) {
                                 c_time = time(NULL);
                         }
 



More information about the samba-cvs mailing list