ctime -> silc_get_time.
[silc.git] / lib / silcsftp / sftp_fs_memory.c
index ef6eb230c7c08defdba9c23c88b9d6d093a21555..7d1cba04679135ddc7045332c9329b99f434e801 100644 (file)
@@ -33,7 +33,7 @@ typedef struct MemFSEntryStruct {
   SilcUInt32 entry_count;                  /* Number of files and sub-directories */
   struct MemFSEntryStruct *parent;  /* non-NULL if `directory' is TRUE,
                                       includes parent directory. */
-  unsigned long created;           /* Time of creation */
+  SilcUInt32 created;              /* Time of creation */
   char *name;                       /* Name of the entry */
   char *data;                      /* Data of the entry */
   unsigned int directory : 1;      /* Set if this is directory */
@@ -775,12 +775,15 @@ void mem_readdir(void *context, SilcSFTP sftp,
     filesize = sizeof(*entry);
     memset(long_name, 0, sizeof(long_name));
 
-    date = ctime(&entry->created);
+    date = (char *)silc_get_time(entry->created);
     if (strrchr(date, ':'))
       *strrchr(date, ':') = '\0';
 
-    if (!entry->directory)
+    if (!entry->directory) {
       filesize = silc_file_size(entry->data + 7);
+      memset(&stats, 0, sizeof(stats));
+      stat(entry->data + 7, &stats);
+    }
 
     /* Long name format is:
        drwx------   1   324210 Apr  8 08:40 mail/
@@ -1071,7 +1074,7 @@ void mem_realpath(void *context, SilcSFTP sftp,
     goto fail;
   name->count = 1;
 
-  (*callback)(sftp, SILC_SFTP_STATUS_FAILURE, (const SilcSFTPName)name, 
+  (*callback)(sftp, SILC_SFTP_STATUS_OK, (const SilcSFTPName)name, 
              callback_context);
 
   silc_sftp_name_free(name);