mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-26 14:04:12 +03:00
Remove magic argument numbers to exit(2)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
ea4683ba06
commit
e8cbd4b8c5
1
cfg.mk
1
cfg.mk
@ -21,7 +21,6 @@ local-checks-to-skip = \
|
||||
sc_program_name \
|
||||
sc_bindtextdomain \
|
||||
sc_prohibit_empty_lines_at_EOF \
|
||||
sc_prohibit_magic_number_exit \
|
||||
sc_prohibit_path_max_allocation \
|
||||
sc_prohibit_test_double_equal \
|
||||
sc_space_tab \
|
||||
|
@ -126,7 +126,7 @@ void
|
||||
ot_util_fatal_literal (const char *msg)
|
||||
{
|
||||
g_printerr ("%s\n", msg);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -83,7 +83,7 @@ import_one_object_thread (gpointer object,
|
||||
if (local_error != NULL)
|
||||
{
|
||||
g_printerr ("%s\n", local_error->message);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ main(int argc, char *argv[])
|
||||
if (argc < 2)
|
||||
{
|
||||
fprintf (stderr, "usage: ostree-prepare-root SYSROOT\n");
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
root_mountpoint = argv[1];
|
||||
@ -132,7 +132,7 @@ main(int argc, char *argv[])
|
||||
if (!ostree_target)
|
||||
{
|
||||
fprintf (stderr, "No OSTree target; expected ostree=/ostree/boot.N/...\n");
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
snprintf (destpath, sizeof(destpath), "%s/%s", root_mountpoint, ostree_target);
|
||||
@ -140,18 +140,18 @@ main(int argc, char *argv[])
|
||||
if (lstat (destpath, &stbuf) < 0)
|
||||
{
|
||||
perrorv ("Couldn't find specified OSTree root '%s': ", destpath);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (!S_ISLNK (stbuf.st_mode))
|
||||
{
|
||||
fprintf (stderr, "OSTree target is not a symbolic link: %s\n", destpath);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
deploy_path = realpath (destpath, NULL);
|
||||
if (deploy_path == NULL)
|
||||
{
|
||||
perrorv ("realpath(%s) failed: ", destpath);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
fprintf (stderr, "Resolved OSTree target to: %s\n", deploy_path);
|
||||
|
||||
@ -164,21 +164,21 @@ main(int argc, char *argv[])
|
||||
if (mount (NULL, "/", NULL, MS_REC|MS_PRIVATE, NULL) < 0)
|
||||
{
|
||||
perrorv ("Failed to make \"/\" private mount: %m");
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Make deploy_path a bind mount, so we can move it later */
|
||||
if (mount (deploy_path, deploy_path, NULL, MS_BIND, NULL) < 0)
|
||||
{
|
||||
perrorv ("failed to initial bind mount %s", deploy_path);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
snprintf (destpath, sizeof(destpath), "%s/sysroot", deploy_path);
|
||||
if (mount (root_mountpoint, destpath, NULL, MS_BIND, NULL) < 0)
|
||||
{
|
||||
perrorv ("Failed to bind mount %s to '%s'", root_mountpoint, destpath);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
snprintf (srcpath, sizeof(srcpath), "%s/../../var", deploy_path);
|
||||
@ -186,7 +186,7 @@ main(int argc, char *argv[])
|
||||
if (mount (srcpath, destpath, NULL, MS_MGC_VAL|MS_BIND, NULL) < 0)
|
||||
{
|
||||
perrorv ("failed to bind mount %s to %s", srcpath, destpath);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
for (i = 0; readonly_bind_mounts[i] != NULL; i++)
|
||||
@ -195,12 +195,12 @@ main(int argc, char *argv[])
|
||||
if (mount (destpath, destpath, NULL, MS_BIND, NULL) < 0)
|
||||
{
|
||||
perrorv ("failed to bind mount (class:readonly) %s", destpath);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (mount (destpath, destpath, NULL, MS_BIND | MS_REMOUNT | MS_RDONLY, NULL) < 0)
|
||||
{
|
||||
perrorv ("failed to bind mount (class:readonly) %s", destpath);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,9 +213,9 @@ main(int argc, char *argv[])
|
||||
if (mount (deploy_path, root_mountpoint, NULL, MS_MOVE, NULL) < 0)
|
||||
{
|
||||
perrorv ("failed to MS_MOVE %s to %s", deploy_path, root_mountpoint);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ path_is_on_readonly_fs (char *path)
|
||||
if (statvfs (path, &stvfsbuf) == -1)
|
||||
{
|
||||
perrorv ("statvfs(%s): ", path);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return (stvfsbuf.f_flag & ST_RDONLY) != 0;
|
||||
@ -70,7 +70,7 @@ maybe_mount_tmpfs_on_var (void)
|
||||
if (mount ("tmpfs", "/var", "tmpfs", 0, NULL) < 0)
|
||||
{
|
||||
perror ("failed to mount tmpfs on /var");
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ main(int argc, char *argv[])
|
||||
|
||||
maybe_mount_tmpfs_on_var ();
|
||||
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
for (i = 0; remounts[i] != NULL; i++)
|
||||
@ -110,13 +110,13 @@ main(int argc, char *argv[])
|
||||
if (errno != EINVAL)
|
||||
{
|
||||
perrorv ("failed to remount %s", target);
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
maybe_mount_tmpfs_on_var ();
|
||||
|
||||
exit (0);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user