mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-26 23:37:22 +00:00
coverity: #1425758
Time of check time of use Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
b29e05d629
commit
d3ccc04e79
@ -924,16 +924,9 @@ static int lxc_setup_ttys(struct lxc_conf *conf)
|
|||||||
/* If we populated /dev, then we need to create
|
/* If we populated /dev, then we need to create
|
||||||
* /dev/ttyN
|
* /dev/ttyN
|
||||||
*/
|
*/
|
||||||
ret = access(path, F_OK);
|
ret = mknod(path, S_IFREG | 0000, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) /* this isn't fatal, continue */
|
||||||
ret = creat(path, 0660);
|
ERROR("%s - Failed to create \"%s\"", strerror(errno), path);
|
||||||
if (ret < 0) {
|
|
||||||
SYSERROR("Failed to create \"%s\"", path);
|
|
||||||
/* this isn't fatal, continue */
|
|
||||||
} else {
|
|
||||||
close(ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = mount(tty->name, path, "none", MS_BIND, 0);
|
ret = mount(tty->name, path, "none", MS_BIND, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -941,8 +934,7 @@ static int lxc_setup_ttys(struct lxc_conf *conf)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG("Bind mounted \"%s\" onto \"%s\"", tty->name,
|
DEBUG("Bind mounted \"%s\" onto \"%s\"", tty->name, path);
|
||||||
path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!append_ttyname(&conf->ttys.tty_names, tty->name)) {
|
if (!append_ttyname(&conf->ttys.tty_names, tty->name)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user