diff options
author | Derrell Lipman <derrell@samba.org> | 2005-06-03 18:54:32 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:57:05 -0500 |
commit | bf484a8f8e7d3c925a4916fdbb91c2843532ec63 (patch) | |
tree | d04eed124b535d5d69d7952ac15e289cba3bb9bb /source3 | |
parent | 5084d49052f47626b61e53add818fefaacc101b0 (diff) | |
download | samba-bf484a8f8e7d3c925a4916fdbb91c2843532ec63.tar.gz samba-bf484a8f8e7d3c925a4916fdbb91c2843532ec63.tar.bz2 samba-bf484a8f8e7d3c925a4916fdbb91c2843532ec63.zip |
r7245: bug fixes in libsmbclient, setting time attributes
(This used to be commit bf33902c059b7f222f89673ce07c8f929860a85f)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/libsmbclient.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index bf3307cfb8..2b511050ce 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -1282,13 +1282,22 @@ static BOOL smbc_setatr(SMBCCTX * context, SMBCSRV *srv, char *path, * 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 @@ -1346,7 +1355,7 @@ static BOOL smbc_setatr(SMBCCTX * context, SMBCSRV *srv, char *path, /* 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); } |