On Tue, 12.05.15 00:58, Thomas H.P. Andersen ([email protected]) wrote:
>
> +#define FSCK_NO_ERROR 0
> +#define FSCK_ERROR_CORRECTED 1
> +#define FSCK_SYSTEM_SHOULD_REBOOT 2
> +#define FSCK_ERRORS_LEFT_UNCORRECTED 4
> +#define FSCK_OPERATIONAL_ERROR 8
> +#define FSCK_USAGE_OR_SYNTAX_ERROR 16
> +#define FSCK_USER_CANCELLED 32
> +#define FSCK_SHARED_LIB_ERROR 128
Makes sense, but can you make this an enum? Also, please add a comment
referencing the documentation in fsck(8) for this.
> +
> static bool arg_skip = false;
> static bool arg_force = false;
> static bool arg_show_progress = false;
> @@ -424,7 +433,7 @@ int main(int argc, char *argv[]) {
> cmdline[i++] = NULL;
>
> execv(cmdline[0], (char**) cmdline);
> - _exit(8); /* Operational error */
> + _exit(FSCK_OPERATIONAL_ERROR);
> }
>
> progress_pipe[1] = safe_close(progress_pipe[1]);
> @@ -448,10 +457,10 @@ int main(int argc, char *argv[]) {
>
> r = -EINVAL;
>
> - if (status.si_code == CLD_EXITED && (status.si_status & 2)
> && root_directory)
> + if (status.si_code == CLD_EXITED && (status.si_status &
> FSCK_SYSTEM_SHOULD_REBOOT) && root_directory)
> /* System should be rebooted. */
> start_target(SPECIAL_REBOOT_TARGET);
> - else if (status.si_code == CLD_EXITED && (status.si_status &
> 6))
> + else if (status.si_code == CLD_EXITED && (status.si_status &
> (FSCK_SYSTEM_SHOULD_REBOOT | FSCK_ERRORS_LEFT_UNCORRECTED)))
> /* Some other problem */
> start_target(SPECIAL_EMERGENCY_TARGET);
> else {
> @@ -462,7 +471,7 @@ int main(int argc, char *argv[]) {
> } else
> r = 0;
>
> - if (status.si_code == CLD_EXITED && (status.si_status & 1))
> + if (status.si_code == CLD_EXITED && (status.si_status &
> FSCK_ERROR_CORRECTED))
> (void) touch("/run/systemd/quotacheck");
>
> finish:
> --
> 2.4.0
>
> _______________________________________________
> systemd-devel mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Lennart
--
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel