diff --git a/server/gc/seaf-fsck.c b/server/gc/seaf-fsck.c index 3595208f..171628f6 100644 --- a/server/gc/seaf-fsck.c +++ b/server/gc/seaf-fsck.c @@ -151,7 +151,7 @@ main(int argc, char *argv[]) #ifdef __linux__ uid_t current_user, seafile_user; - if (!force && !check_user (seafile_dir, ¤t_user, &seafile_user)) { + if (!export_path && !force && !check_user (seafile_dir, ¤t_user, &seafile_user)) { seaf_message ("Current user (%u) is not the user for running " "seafile server (%u). Unable to run fsck.\n", current_user, seafile_user); diff --git a/server/repo-op.c b/server/repo-op.c index f933f596..5f1916f6 100644 --- a/server/repo-op.c +++ b/server/repo-op.c @@ -1024,17 +1024,20 @@ check_files_with_same_name (SeafRepo *repo, const char *parent_dir, GList *filen char *canon_path = NULL; SeafCommit *commit = NULL; SeafDir *dir = NULL; - GError *error = NULL; gboolean ret = FALSE; - GET_COMMIT_OR_FAIL(commit, repo->id, repo->version, repo->head->commit_id); + commit = seaf_commit_manager_get_commit(seaf->commit_mgr, repo->id, repo->version, repo->head->commit_id); + if (!commit) { + seaf_warning ("commit %s:%s doesn't exist.\n", repo->id, repo->head->commit_id); + goto out; + } canon_path = get_canonical_path (parent_dir); dir = seaf_fs_manager_get_seafdir_by_path (seaf->fs_mgr, repo->store_id, repo->version, commit->root_id, - canon_path, &error); + canon_path, NULL); if (!dir) { goto out; } @@ -1051,7 +1054,6 @@ check_files_with_same_name (SeafRepo *repo, const char *parent_dir, GList *filen g_free (unique_name); } out: - g_clear_error (&error); g_free (canon_path); seaf_dir_free (dir); seaf_commit_unref (commit); @@ -6531,7 +6533,7 @@ hash_to_list (gpointer key, gpointer value, gpointer user_data) } static gint -compare_commit_by_time (gconstpointer a, gconstpointer b, gpointer unused) +compare_commit_by_time_ex (gconstpointer a, gconstpointer b) { const SeafCommit *commit_a = a; const SeafCommit *commit_b = b; @@ -6540,6 +6542,12 @@ compare_commit_by_time (gconstpointer a, gconstpointer b, gpointer unused) return (commit_b->ctime - commit_a->ctime); } +static gint +compare_commit_by_time (gconstpointer a, gconstpointer b, gpointer unused) +{ + return compare_commit_by_time_ex(a, b); +} + static int insert_parent_commit (GList **list, GHashTable *hash, const char *repo_id, int version, @@ -6597,7 +6605,7 @@ scan_stat_to_list(const char *scan_stat, GHashTable *commit_hash, SeafRepo *repo } } json_decref (commit_array); - list = g_list_sort (list, compare_commit_by_time); + list = g_list_sort (list, compare_commit_by_time_ex); return list; }