X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/ef77015ecbc711f60630bc90c67da65b7480100a..bdc54107c5a7268f3a700335389bf494df136bf7:/sbin/hammer/cmd_cleanup.c diff --git a/sbin/hammer/cmd_cleanup.c b/sbin/hammer/cmd_cleanup.c index 4bee7ea134..83426842ef 100644 --- a/sbin/hammer/cmd_cleanup.c +++ b/sbin/hammer/cmd_cleanup.c @@ -617,7 +617,11 @@ migrate_one_snapshot(int fd, const char *fpath, t = (time_t)-1; tid = (hammer_tid_t)(int64_t)-1; - ptr = fpath; + /* fpath may contain directory components */ + if ((ptr = strrchr(fpath, '/')) != NULL) + ++ptr; + else + ptr = fpath; while (*ptr && *ptr != '-' && *ptr != '.') ++ptr; if (*ptr) @@ -649,6 +653,9 @@ migrate_one_snapshot(int fd, const char *fpath, snprintf(snap->label, sizeof(snap->label), "migrated"); ++snapshot->count; + } else { + printf(" non-canonical snapshot softlink: %s->%s\n", + fpath, linkbuf); } } @@ -717,6 +724,8 @@ dividing_slash(const char *path) * Periods in minutes, hours, or days are assumed to have been crossed * if the local time crosses a minute, hour, or day boundary regardless * of how close the last operation actually was. + * + * If ForceOpt is set always return true. */ static int check_period(const char *snapshots_path, const char *cmd, int arg1, @@ -732,6 +741,12 @@ check_period(const char *snapshots_path, const char *cmd, int arg1, time(savep); localtime_r(savep, &tp1); + /* + * Force run if -F + */ + if (ForceOpt) + return(1); + /* * Retrieve the start time of the last successful operation. */