Unverified Commit 368f7486 by 2xsec Committed by Christian Brauner

storage_utils: use _exit() instead of exit() in child process

Signed-off-by: 's avatar2xsec <dh48.jeong@samsung.com>
parent ae9870d6
...@@ -243,7 +243,7 @@ int detect_fs(struct lxc_storage *bdev, char *type, int len) ...@@ -243,7 +243,7 @@ int detect_fs(struct lxc_storage *bdev, char *type, int len)
} }
if (unshare(CLONE_NEWNS) < 0) if (unshare(CLONE_NEWNS) < 0)
exit(1); _exit(EXIT_FAILURE);
if (detect_shared_rootfs()) if (detect_shared_rootfs())
if (mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL)) { if (mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL)) {
...@@ -255,21 +255,21 @@ int detect_fs(struct lxc_storage *bdev, char *type, int len) ...@@ -255,21 +255,21 @@ int detect_fs(struct lxc_storage *bdev, char *type, int len)
if (ret < 0) { if (ret < 0) {
ERROR("Failed to mount \"%s\" onto \"%s\" to detect FSType", srcdev, ERROR("Failed to mount \"%s\" onto \"%s\" to detect FSType", srcdev,
bdev->dest); bdev->dest);
exit(1); _exit(EXIT_FAILURE);
} }
l = linkderef(srcdev, devpath); l = linkderef(srcdev, devpath);
if (!l) if (!l)
exit(1); _exit(EXIT_FAILURE);
f = fopen("/proc/self/mounts", "r"); f = fopen("/proc/self/mounts", "r");
if (!f) if (!f)
exit(1); _exit(EXIT_FAILURE);
while (getline(&line, &linelen, f) != -1) { while (getline(&line, &linelen, f) != -1) {
sp1 = strchr(line, ' '); sp1 = strchr(line, ' ');
if (!sp1) if (!sp1)
exit(1); _exit(EXIT_FAILURE);
*sp1 = '\0'; *sp1 = '\0';
if (strcmp(line, l)) if (strcmp(line, l))
...@@ -277,22 +277,22 @@ int detect_fs(struct lxc_storage *bdev, char *type, int len) ...@@ -277,22 +277,22 @@ int detect_fs(struct lxc_storage *bdev, char *type, int len)
sp2 = strchr(sp1 + 1, ' '); sp2 = strchr(sp1 + 1, ' ');
if (!sp2) if (!sp2)
exit(1); _exit(EXIT_FAILURE);
*sp2 = '\0'; *sp2 = '\0';
sp3 = strchr(sp2 + 1, ' '); sp3 = strchr(sp2 + 1, ' ');
if (!sp3) if (!sp3)
exit(1); _exit(EXIT_FAILURE);
*sp3 = '\0'; *sp3 = '\0';
sp2++; sp2++;
if (write(p[1], sp2, strlen(sp2)) != strlen(sp2)) if (write(p[1], sp2, strlen(sp2)) != strlen(sp2))
exit(1); _exit(EXIT_FAILURE);
exit(0); _exit(EXIT_SUCCESS);
} }
exit(1); _exit(EXIT_FAILURE);
} }
int do_mkfs_exec_wrapper(void *args) int do_mkfs_exec_wrapper(void *args)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment