summaryrefslogtreecommitdiff
path: root/src/switchroot
diff options
context:
space:
mode:
authorWilliam Manley <will@williammanley.net>2016-08-31 17:07:17 +0100
committerAtomic Bot <atomic-devel@projectatomic.io>2016-09-01 20:17:58 +0000
commit5424404813a3f9ca65d1d9e7a4b2efbaebef71cf (patch)
tree402e6d7c75719a03c88e6dd476c8fcc924b6049e /src/switchroot
parent598e3240ff523ca827d225271b6e68da90a5e572 (diff)
downloadostree-5424404813a3f9ca65d1d9e7a4b2efbaebef71cf.tar.gz
ostree-prepare-root: Error if realpath fails
I've seen it fail with musl which needs `/proc` to be mounted for it to work. The error messages we're rather confusing before. At least this now points to the right location. Closes: #485 Approved by: cgwalters
Diffstat (limited to 'src/switchroot')
-rw-r--r--src/switchroot/ostree-prepare-root.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c
index d866f88e..ea7333b5 100644
--- a/src/switchroot/ostree-prepare-root.c
+++ b/src/switchroot/ostree-prepare-root.c
@@ -174,17 +174,19 @@ pivot_root(const char * new_root, const char * put_old)
int
main(int argc, char *argv[])
{
- const char *root_mountpoint = NULL;
+ const char *root_mountpoint = NULL, *root_arg = NULL;
char *deploy_path = NULL;
char srcpath[PATH_MAX];
struct stat stbuf;
if (argc < 2)
- root_mountpoint = "/";
+ root_arg = "/";
else
- root_mountpoint = argv[1];
+ root_arg = argv[1];
- root_mountpoint = realpath (root_mountpoint, NULL);
+ root_mountpoint = realpath (root_arg, NULL);
+ if (root_mountpoint == NULL)
+ err (EXIT_FAILURE, "realpath(\"%s\")", root_arg);
deploy_path = resolve_deploy_path (root_mountpoint);
/* Work-around for a kernel bug: for some reason the kernel