summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/collect/collect.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c
index dc849bd0f0..90df360eb2 100644
--- a/src/udev/collect/collect.c
+++ b/src/udev/collect/collect.c
@@ -86,12 +86,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);