diff options
Diffstat (limited to 'source3/client')
-rw-r--r-- | source3/client/client.c | 26 | ||||
-rw-r--r-- | source3/client/clitar.c | 2 | ||||
-rw-r--r-- | source3/client/smbctool.c | 30 |
3 files changed, 45 insertions, 13 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index 1fbee70645..aa25d9aba5 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -379,7 +379,7 @@ static void display_finfo(file_info *finfo) finfo->name, attrib_string(finfo->mode), (double)finfo->size, - asctime(localtime(&t))); + time_to_asc(&t)); dir_total += finfo->size; } } @@ -2111,6 +2111,7 @@ static int cmd_stat(void) fstring mode_str; SMB_STRUCT_STAT sbuf; struct cli_state *targetcli; + struct tm *lt; pstring targetname; if (!SERVER_HAS_UNIX_CIFS(cli)) { @@ -2165,13 +2166,28 @@ static int cmd_stat(void) (unsigned int)sbuf.st_uid, (unsigned int)sbuf.st_gid); - strftime(mode_str, sizeof(mode_str), "%F %T %z", localtime(&sbuf.st_atime)); + lt = localtime(&sbuf.st_atime); + if (lt) { + strftime(mode_str, sizeof(mode_str), "%F %T %z", lt); + } else { + fstrcpy(mode_str, "unknown"); + } d_printf("Access: %s\n", mode_str); - strftime(mode_str, sizeof(mode_str), "%F %T %z", localtime(&sbuf.st_mtime)); + lt = localtime(&sbuf.st_mtime); + if (lt) { + strftime(mode_str, sizeof(mode_str), "%F %T %z", lt); + } else { + fstrcpy(mode_str, "unknown"); + } d_printf("Modify: %s\n", mode_str); - strftime(mode_str, sizeof(mode_str), "%F %T %z", localtime(&sbuf.st_ctime)); + lt = localtime(&sbuf.st_ctime); + if (lt) { + strftime(mode_str, sizeof(mode_str), "%F %T %z", lt); + } else { + fstrcpy(mode_str, "unknown"); + } d_printf("Change: %s\n", mode_str); return 0; @@ -2339,7 +2355,7 @@ static int cmd_newer(void) if (ok && (sys_stat(buf,&sbuf) == 0)) { newer_than = sbuf.st_mtime; DEBUG(1,("Getting files newer than %s", - asctime(localtime(&newer_than)))); + time_to_asc(&newer_than))); } else { newer_than = 0; } diff --git a/source3/client/clitar.c b/source3/client/clitar.c index a7bc4bfde3..14c28acfc5 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -1641,7 +1641,7 @@ int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind) if (sys_stat(argv[Optind], &stbuf) == 0) { newer_than = stbuf.st_mtime; DEBUG(1,("Getting files newer than %s", - asctime(localtime(&newer_than)))); + time_to_asc(&newer_than))); newOptind++; Optind++; } else { diff --git a/source3/client/smbctool.c b/source3/client/smbctool.c index ba095aee84..5b21d195b7 100644 --- a/source3/client/smbctool.c +++ b/source3/client/smbctool.c @@ -445,7 +445,7 @@ static void display_finfo(file_info *finfo) finfo->name, attrib_string(finfo->mode), (double)finfo->size, - asctime(localtime(&t))); + time_to_asc(&t)); dir_total += finfo->size; } } @@ -458,7 +458,7 @@ static void display_stat(char *name, struct stat *st) { time_t t = st->st_mtime; pstring time_str; - pstrcpy(time_str, asctime(localtime(&t))); + pstrcpy(time_str, time_to_asc(&t)); time_str[strlen(time_str)-1] = 0; d_printf("> %-30s", name); d_printf("%10.10s %8.0f %s\n", *mode_t_string(st->st_mode), (double)st->st_size, time_str); @@ -2303,6 +2303,7 @@ static int cmd_stat(void) fstring mode_str; SMB_STRUCT_STAT sbuf; struct cli_state *targetcli; + struct tm *lt; pstring targetname; if (!SERVER_HAS_UNIX_CIFS(cli)) { @@ -2357,15 +2358,30 @@ static int cmd_stat(void) (unsigned int)sbuf.st_uid, (unsigned int)sbuf.st_gid); - strftime(mode_str, sizeof(mode_str), "%F %T %z", localtime(&sbuf.st_atime)); + lt = localtime(&sbuf.st_atime); + if (lt) { + strftime(mode_str, sizeof(mode_str), "%F %T %z", lt); + } else { + fstrcpy(mode_str, "unknown"); + } d_printf("Access: %s\n", mode_str); - strftime(mode_str, sizeof(mode_str), "%F %T %z", localtime(&sbuf.st_mtime)); + lt = localtime(&sbuf.st_mtime); + if (lt) { + strftime(mode_str, sizeof(mode_str), "%F %T %z", lt); + } else { + fstrcpy(mode_str, "unknown"); + } d_printf("Modify: %s\n", mode_str); - strftime(mode_str, sizeof(mode_str), "%F %T %z", localtime(&sbuf.st_ctime)); + lt = localtime(&sbuf.st_ctime); + if (lt) { + strftime(mode_str, sizeof(mode_str), "%F %T %z", lt); + } else { + fstrcpy(mode_str, "unknown"); + } d_printf("Change: %s\n", mode_str); - + return 0; } @@ -2538,7 +2554,7 @@ static int cmd_newer(void) if (ok && (sys_stat(buf,&sbuf) == 0)) { newer_than = sbuf.st_mtime; DEBUG(1,("Getting files newer than %s", - asctime(localtime(&newer_than)))); + time_to_asc(&newer_than))); } else { newer_than = 0; } |