Skip to content

Commit

Permalink
storage_utils: use _exit() instead of exit() in child process
Browse files Browse the repository at this point in the history
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
  • Loading branch information
2xsec authored and Christian Brauner committed Nov 22, 2018
1 parent ae9870d commit 368f748
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/lxc/storage/storage_utils.c
Expand Up @@ -243,7 +243,7 @@ int detect_fs(struct lxc_storage *bdev, char *type, int len)
}

if (unshare(CLONE_NEWNS) < 0)
exit(1);
_exit(EXIT_FAILURE);

if (detect_shared_rootfs())
if (mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL)) {
Expand All @@ -255,44 +255,44 @@ int detect_fs(struct lxc_storage *bdev, char *type, int len)
if (ret < 0) {
ERROR("Failed to mount \"%s\" onto \"%s\" to detect FSType", srcdev,
bdev->dest);
exit(1);
_exit(EXIT_FAILURE);
}

l = linkderef(srcdev, devpath);
if (!l)
exit(1);
_exit(EXIT_FAILURE);

f = fopen("/proc/self/mounts", "r");
if (!f)
exit(1);
_exit(EXIT_FAILURE);

while (getline(&line, &linelen, f) != -1) {
sp1 = strchr(line, ' ');
if (!sp1)
exit(1);
_exit(EXIT_FAILURE);

*sp1 = '\0';
if (strcmp(line, l))
continue;

sp2 = strchr(sp1 + 1, ' ');
if (!sp2)
exit(1);
_exit(EXIT_FAILURE);
*sp2 = '\0';

sp3 = strchr(sp2 + 1, ' ');
if (!sp3)
exit(1);
_exit(EXIT_FAILURE);
*sp3 = '\0';

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)
Expand Down

0 comments on commit 368f748

Please sign in to comment.