mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-07 15:29:02 +00:00
tools: use fclose() after fdopen() + add newline
So far we accidently used close() on the original file descriptor. (After fdopen() the original fd is considered private and should not be used anymore. The close operations should be performed on the new file handle. We did the correct thing on error but not on success.) Using close() on the original fd caused "Text file busy" errors and prevented the cloned tmpfs container from starting. Signed-off-by: Christian Brauner <cbrauner@suse.de>
This commit is contained in:
parent
4b281e1264
commit
b44c42e8f0
@ -454,7 +454,7 @@ static int do_clone_ephemeral(struct lxc_container *c,
|
|||||||
|
|
||||||
if (arg->tmpfs && !my_args.quiet)
|
if (arg->tmpfs && !my_args.quiet)
|
||||||
printf("Container is placed on tmpfs.\nRebooting will cause "
|
printf("Container is placed on tmpfs.\nRebooting will cause "
|
||||||
"all changes made to it to be lost!");
|
"all changes made to it to be lost!\n");
|
||||||
|
|
||||||
if (!arg->daemonize && arg->argc) {
|
if (!arg->daemonize && arg->argc) {
|
||||||
clone->want_daemonize(clone, true);
|
clone->want_daemonize(clone, true);
|
||||||
@ -863,7 +863,7 @@ static char *mount_tmpfs(const char *oldname, const char *newname,
|
|||||||
goto err_close;
|
goto err_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
close(fd);
|
fclose(fp);
|
||||||
return premount;
|
return premount;
|
||||||
|
|
||||||
err_close:
|
err_close:
|
||||||
|
Loading…
Reference in New Issue
Block a user