mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
fish: copy-out: Fail on some errors when creating output directory (found by Coverity).
However it's not an error if the output directory already exists.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <libintl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -378,7 +379,10 @@ make_tar_output (const char *local, const char *basename)
|
||||
_exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
mkdir (basename, 0777);
|
||||
if (mkdir (basename, 0777) == -1 && errno != EEXIST) {
|
||||
perror (basename);
|
||||
_exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (chdir (basename) == -1) {
|
||||
perror (basename);
|
||||
|
||||
Reference in New Issue
Block a user