Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip check user when export file and fix build error #659

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/gc/seaf-fsck.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ main(int argc, char *argv[])

#ifdef __linux__
uid_t current_user, seafile_user;
if (!force && !check_user (seafile_dir, &current_user, &seafile_user)) {
if (!export_path && !force && !check_user (seafile_dir, &current_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);
Expand Down
20 changes: 14 additions & 6 deletions server/repo-op.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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;
}

Expand Down
Loading