mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-26 05:21:19 +00:00
lxc_user_nic: report failing filename in open_and_lock error cases
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
78f97d4c4f
commit
c8f73ce205
@ -105,7 +105,8 @@ int open_and_lock(char *path)
|
|||||||
|
|
||||||
fd = open(path, O_RDWR|O_CREAT, S_IWUSR | S_IRUSR);
|
fd = open(path, O_RDWR|O_CREAT, S_IWUSR | S_IRUSR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
perror("open");
|
fprintf(stderr, "Failed to open %s: %s\n",
|
||||||
|
path, strerror(errno));
|
||||||
return(fd);
|
return(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +115,8 @@ int open_and_lock(char *path)
|
|||||||
lk.l_start = 0;
|
lk.l_start = 0;
|
||||||
lk.l_len = 0;
|
lk.l_len = 0;
|
||||||
if (fcntl(fd, F_SETLKW, &lk) < 0) {
|
if (fcntl(fd, F_SETLKW, &lk) < 0) {
|
||||||
perror("fcntl lock");
|
fprintf(stderr, "Failed to lock %s: %s\n",
|
||||||
|
path, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user