summaryrefslogtreecommitdiff
path: root/examples/libsmbclient/teststat.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/libsmbclient/teststat.c')
-rw-r--r--examples/libsmbclient/teststat.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/examples/libsmbclient/teststat.c b/examples/libsmbclient/teststat.c
index bea34cfc09..d67f626d78 100644
--- a/examples/libsmbclient/teststat.c
+++ b/examples/libsmbclient/teststat.c
@@ -9,6 +9,9 @@
int main(int argc, char * argv[])
{
char buffer[16384];
+ char mtime[32];
+ char ctime[32];
+ char atime[32];
char * pSmbPath = NULL;
char * pLocalPath = NULL;
struct stat st;
@@ -38,21 +41,29 @@ int main(int argc, char * argv[])
smbc_init(get_auth_data_fn, 0);
- int ret = smbc_stat(pSmbPath, &st);
+ if (smbc_stat(pSmbPath, &st) < 0)
+ {
+ perror("smbc_stat");
+ return 1;
+ }
- printf("SAMBA\nret=%d,\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n", ret,
- st.st_mtime, ctime(&st.st_mtime),
- st.st_ctime, ctime(&st.st_ctime),
- st.st_atime, ctime(&st.st_atime));
+ printf("SAMBA\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
+ st.st_mtime, ctime_r(&st.st_mtime, mtime),
+ st.st_ctime, ctime_r(&st.st_ctime, ctime),
+ st.st_atime, ctime_r(&st.st_atime, atime));
if (pLocalPath != NULL)
{
- ret = stat(pLocalPath, &st);
+ if (stat(pLocalPath, &st) < 0)
+ {
+ perror("stat");
+ return 1;
+ }
- printf("LOCAL\nret=%d,\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n", ret,
- st.st_mtime, ctime(&st.st_mtime),
- st.st_ctime, ctime(&st.st_ctime),
- st.st_atime, ctime(&st.st_atime));
+ printf("LOCAL\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
+ st.st_mtime, ctime_r(&st.st_mtime, mtime),
+ st.st_ctime, ctime_r(&st.st_ctime, ctime),
+ st.st_atime, ctime_r(&st.st_atime, atime));
}
return 0;