Merge commit 'fml/master'
[adu.git] / create.c
index 638ba19..9b26f72 100644 (file)
--- a/create.c
+++ b/create.c
@@ -30,8 +30,6 @@ static int write_uid(struct user_info *ui, void *data)
 static int write_uid_list(void)
 {
        char *buf, *p, *filename;
-       uint32_t count = 0;
-       struct user_info *ui;
        size_t size = num_uids * sizeof(uint32_t);
        int ret;
 
@@ -133,7 +131,7 @@ static int scan_dir(char *dirname, uint64_t *parent_dir_num)
        }
        while ((entry = readdir(dir))) {
                mode_t m;
-               struct stat s;
+               struct stat64 s;
                uint32_t uid;
                uint64_t size;
                struct user_info *ui;
@@ -142,9 +140,9 @@ static int scan_dir(char *dirname, uint64_t *parent_dir_num)
                        continue;
                if (!strcmp(entry->d_name, ".."))
                        continue;
-               if (lstat(entry->d_name, &s) == -1) {
-                       WARNING_LOG("lstat error for %s/%s\n", dirname,
-                               entry->d_name);
+               if (lstat64(entry->d_name, &s) == -1) {
+                       WARNING_LOG("lstat64 error for %s/%s (%s)\n",
+                               dirname, entry->d_name, strerror(errno));
                        continue;
                }
                m = s.st_mode;
@@ -163,7 +161,7 @@ static int scan_dir(char *dirname, uint64_t *parent_dir_num)
                dir_size += size;
                dir_files++;
                uid = s.st_uid;
-               ret = search_uid(uid, CREATE_USER_TABLE | OPEN_USER_TABLE, &ui);
+               ret = search_uid(uid, NULL, CREATE_USER_TABLE | OPEN_USER_TABLE, &ui);
                if (ret < 0)
                        goto out;
                ui->bytes += size;
@@ -183,7 +181,7 @@ out:
        return ret;
 }
 
-int com_create()
+int com_create(void)
 {
        uint64_t zero = 0ULL;
        int ret;