break;
default: /* parent */
- wait(&status);
- if (WIFEXITED(status) == 0)
+ if (wait(&status) == -1 || WIFEXITED(status) == 0)
errx(EXIT_FAILURE,
_("unmount of `%s' did not exit normally"), name);
if (WEXITSTATUS(status) != 0)
- errx(EXIT_FAILURE, _("unmount of `%s' failed\n"), name);
+ errx(EXIT_FAILURE, _("unmount of `%s' failed"), name);
break;
}
}
return EXIT_SUCCESS;
}
+ /* clear any inherited settings */
+ signal(SIGCHLD, SIG_DFL);
+
if (!ctl.device) {
ctl.device = mnt_resolve_path(EJECT_DEFAULT_DEVICE, NULL);
verbose(&ctl, _("using default device `%s'"), ctl.device);