touch(): Check return value of mknod(), report error if errno != EEXIST.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2014-11-26 22:57:23 +01:00
parent 1bdcef9a2c
commit 5ff7994852
+1 -1
View File
@@ -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)))