summaryrefslogtreecommitdiff
path: root/src/collect/collect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/collect/collect.c')
-rw-r--r--src/collect/collect.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/collect/collect.c b/src/collect/collect.c
index 7bc6571146..2d1baa1ddc 100644
--- a/src/collect/collect.c
+++ b/src/collect/collect.c
@@ -90,12 +90,12 @@ static void usage(void)
*/
static int prepare(char *dir, char *filename)
{
- struct stat statbuf;
char buf[512];
- int fd;
+ int r, fd;
- if (stat(dir, &statbuf) < 0)
- mkdir(dir, 0700);
+ r = mkdir(dir, 0700);
+ if (r < 0 && errno != EEXIST)
+ return -errno;
snprintf(buf, sizeof(buf), "%s/%s", dir, filename);