r7817: Eliminate use of ctime_r() in libsmbclient DEBUG statement. It seems that
authorDerrell Lipman <derrell@samba.org>
Tue, 21 Jun 2005 20:34:24 +0000 (20:34 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:57:21 +0000 (10:57 -0500)
ctime_r() takes different parameters on Solaris than it does on Linux, and
it's easier to just eliminate the use of it than to write a configure test.

source/libsmb/libsmbclient.c

index 2b511050ce1bbe847adde88b8e772b20fef10885..dac30b934e158fa9228e661ce48985fad8868035 100644 (file)
@@ -3017,14 +3017,26 @@ int smbc_utimes_ctx(SMBCCTX *context, const char *fname, struct timeval *tbuf)
                 m_time = tbuf[1].tv_sec;
         }
 
+        if (DEBUGLVL(4)) 
         {
+                char *p;
                 char atimebuf[32];
                 char mtimebuf[32];
 
-                DEBUG(4, ("smbc_utimes(%s, atime = %s mtime = %s)\n",
-                          fname,
-                          ctime_r(&a_time, atimebuf),
-                          ctime_r(&m_time, mtimebuf)));
+                strncpy(atimebuf, ctime(&a_time), sizeof(atimebuf));
+                atimebuf[sizeof(atimebuf) - 1] = '\0';
+                if ((p = strchr(atimebuf, '\n')) != NULL) {
+                        *p = '\0';
+                }
+
+                strncpy(mtimebuf, ctime(&m_time), sizeof(mtimebuf));
+                mtimebuf[sizeof(mtimebuf) - 1] = '\0';
+                if ((p = strchr(mtimebuf, '\n')) != NULL) {
+                        *p = '\0';
+                }
+
+                dbgtext("smbc_utimes(%s, atime = %s mtime = %s)\n",
+                        fname, atimebuf, mtimebuf);
         }
 
        if (smbc_parse_path(context, fname,