Bug 2806 - Error calling ctime_r from smbc_utimes_ctx on Solaris 9 ff
Summary: Error calling ctime_r from smbc_utimes_ctx on Solaris 9 ff
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.0.9
Hardware: Sparc Solaris
: P3 normal
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-17 06:39 UTC by David S. Collier-Brown
Modified: 2005-08-24 10:23 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David S. Collier-Brown 2005-06-17 06:39:48 UTC
[Note: this is in trunk, not literally 3.0.9]

The compiler saith:
Compiling libsmb/libsmbclient.c with -fPIC
libsmb/libsmbclient.c: In function `smbc_utimes_ctx':
libsmb/libsmbclient.c:3024: error: too few arguments to function `ctime_r'
make[1]: Leaving directory `/export/home/davecb/projects/samba/samba-trunk/source'

The code says:
               DEBUG(4, ("smbc_utimes(%s, atime = %s mtime = %s)\n",
                          fname,
                          ctime_r(&a_time, atimebuf),
                          ctime_r(&m_time, mtimebuf)));

Solaris passes an int buflen to most _r functions, which makes
this call into:

		DEBUG(4, ("smbc_utimes(%s, atime = %s mtime = %s)\n",
                          fname,
                          ctime_r(&a_time, atimebuf, sizeof(atimebuf)),
                          ctime_r(&m_time, mtimebuf, sizeof(mtimebuf))));

Diff -u says:
froggy> diff -u libsmbclient.c.old libsmbclient.c
--- libsmbclient.c.old	2005-06-16 20:21:40.346406000 -0400
+++ libsmbclient.c	2005-06-17 09:35:47.286637000 -0400
@@ -3023,8 +3023,8 @@
 
                 DEBUG(4, ("smbc_utimes(%s, atime = %s mtime = %s)\n",
                           fname,
-                          ctime_r(&a_time, atimebuf),
-                          ctime_r(&m_time, mtimebuf)));
+                          ctime_r(&a_time, atimebuf, sizeof(atimebuf)),
+                          ctime_r(&m_time, mtimebuf, sizeof(mtimebuf))));
         }
 
 	if (smbc_parse_path(context, fname,
Comment 1 David S. Collier-Brown 2005-06-17 09:37:40 UTC
This is the only use of ctime_r that I can find.
Other code uses an idioms like
    DEBUG(6,("actime: %s " , ctime(&tvs.actime)))
I wonder if the ctime_r should just be taken out?

--dave
Comment 2 Derrell Lipman 2005-06-21 13:35:52 UTC
Eliminated use of ctime_r() in DEBUG statement.
Comment 3 Gerald (Jerry) Carter (dead mail address) 2005-08-24 10:23:44 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.