diff options
| author | Jamie Strandboge <jamie@ubuntu.com> | 2016-04-14 15:47:41 -0500 |
|---|---|---|
| committer | Jamie Strandboge <jamie@ubuntu.com> | 2016-04-14 15:47:41 -0500 |
| commit | b21523a32f8a90883128acfe9f212fe3ff73a350 (patch) | |
| tree | e4fedce79841f21590210022ae8bc251968205bc | |
| parent | a61f43cf18c59663a095e6efa23a051dc4499327 (diff) | |
src/main.c: die() if stat fails when errno != ENOENT when checking mount points
| -rw-r--r-- | src/main.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c index b5abbd7a55..cf340717dd 100644 --- a/src/main.c +++ b/src/main.c @@ -331,15 +331,20 @@ void setup_snappy_os_mounts() // but if we do we need to ensure that data like /etc/{hostname,hosts, // passwd,groups} is in sync between the two systems (probably via // selected bind mounts of those files). - const char *mounts[] = { "/bin", "/sbin", "/lib", "/lib32", "/libx32", "/lib64", "/usr" }; + const char *mounts[] = + { "/bin", "/sbin", "/lib", "/lib32", "/libx32", "/lib64", "/usr" }; for (int i = 0; i < sizeof(mounts) / sizeof(char *); i++) { // we mount the OS snap /bin over the real /bin in this NS const char *dst = mounts[i]; - // some system do not have e.g. /lib64 - struct stat sbuf; - if (stat(dst, &sbuf) != 0 && errno == ENOENT) - continue; + // some system do not have e.g. /lib64 + struct stat sbuf; + if (stat(dst, &sbuf) != 0) { + if (errno == ENOENT) + continue; + else + die("could not stat mount point"); + } char buf[512]; must_snprintf(buf, sizeof(buf), "%s%s", mountpoint, dst); |
