diff --git a/src/lite.h b/src/lite.h index 13cb5cc..b64e596 100644 --- a/src/lite.h +++ b/src/lite.h @@ -117,9 +117,9 @@ int whichp (const char *cmd); #include /* utimensat() on *BSD */ static inline int touch(const char *path) { - if (mknod((path), S_IFREG|0644, 0)) { - if (errno == EEXIST) - return utimensat(AT_FDCWD, path, NULL, 0); + if (utimensat(AT_FDCWD, path, NULL, 0)) { + if (errno == ENOENT) + return mknod((path), S_IFREG|0644, 0); return -1; } return 0;