mirror of
https://github.com/troglobit/libite.git
synced 2026-11-11 16:40:42 +00:00
Replace mknod() with creat()
For mknod(), mode must be S_IFIFO otherwise the behaviour is unspecified according to SUS, and apparently Debian/kFreeBSD is in the hater list.
This commit is contained in:
1 parent
059bfd7806
commit
5cdc5736f3
1 file changed
+8
-3
+8
-3
@@ -139,10 +139,15 @@ int whichp (const char *cmd);
|
|||||||
*/
|
*/
|
||||||
static inline int touch(const char *path)
|
static inline int touch(const char *path)
|
||||||
{
|
{
|
||||||
|
int fd;
|
||||||
|
|
||||||
if (utimensat(AT_FDCWD, path, NULL, 0)) {
|
if (utimensat(AT_FDCWD, path, NULL, 0)) {
|
||||||
if (errno == ENOENT)
|
if (errno != ENOENT)
|
||||||
return mknod((path), S_IFREG|0644, 0);
|
return -1;
|
||||||
return -1;
|
fd = creat(path, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
|
||||||
|
if (fd < 0)
|
||||||
|
return -1;
|
||||||
|
close(fd);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user