Always try 'umount -i'

This commit is contained in:
wbaumann
2014-04-05 20:27:31 +00:00
parent 2b1f99b123
commit 9a3e7724be
5 changed files with 68 additions and 34 deletions

View File

@ -125,10 +125,19 @@ main(int argc, char *argv[])
error(EXIT_FAILURE, 0, _("too many arguments"));
char *mpoint = canonicalize_file_name(argv[optind]);
if (!mpoint)
mpoint = argv[optind];
if (!mpoint || *mpoint != '/')
error(EXIT_FAILURE, errno, _("can't determine mount point"));
char *umount_command = NULL;
if (mpoint) {
umount_command = ne_concat("umount -i '", mpoint, "'", NULL);
} else {
umount_command = ne_concat("umount -i '", argv[optind], "'", NULL);
error(0, 0,
_("\n"
" can't evaluate PID file name;\n"
" trying to unmount anyway;\n"
" please wait for %s to terminate"), PROGRAM_NAME);
return system(umount_command);
}
char *m = mpoint;
while (*m == '/')
@ -142,8 +151,6 @@ main(int argc, char *argv[])
char *pidfile = xasprintf("%s/%s.pid", DAV_SYS_RUN, mp);
free(mp);
char *umount_command = xasprintf("umount -i '%s'", mpoint);
char pid[32];
FILE *file = fopen(pidfile, "r");
if (!file || fscanf(file, "%30[0-9]", pid) < 1) {