]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc_user_nic: report failing filename in open_and_lock error cases
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 19 Nov 2013 16:17:48 +0000 (16:17 +0000)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 19 Nov 2013 22:26:58 +0000 (16:26 -0600)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/lxc_user_nic.c

index 0b82a5033d149dcbefb50300893d5e003f29366b..4154e8341b7b8445e147517b6b6a85c9dcda6a60 100644 (file)
@@ -105,7 +105,8 @@ int open_and_lock(char *path)
 
        fd = open(path, O_RDWR|O_CREAT, S_IWUSR | S_IRUSR);
        if (fd < 0) {
-               perror("open");
+               fprintf(stderr, "Failed to open %s: %s\n",
+                       path, strerror(errno));
                return(fd);
        }
 
@@ -114,7 +115,8 @@ int open_and_lock(char *path)
        lk.l_start = 0;
        lk.l_len = 0;
        if (fcntl(fd, F_SETLKW, &lk) < 0) {
-               perror("fcntl lock");
+               fprintf(stderr, "Failed to lock %s: %s\n",
+                       path, strerror(errno));
                return -1;
        }