From 5ff7994852e0c14164249e9cfbf5748cbb60fd80 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 26 Nov 2014 22:57:23 +0100 Subject: [PATCH] touch(): Check return value of mknod(), report error if errno != EEXIST. Signed-off-by: Joachim Nilsson --- helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers.h b/helpers.h index 6dafaf7d..da1e879b 100644 --- a/helpers.h +++ b/helpers.h @@ -42,7 +42,7 @@ #ifndef touch -# define touch(x) mknod((x), S_IFREG|0644, 0) +# define touch(x) do { if (mknod((x), S_IFREG|0644, 0) && errno != EEXIST) _pe("Failed creating %s", x); } while (0) #endif #ifndef chardev # define chardev(x,m,maj,min) mknod((x), S_IFCHR|(m), makedev((maj),(min)))