diff --git a/lite.h b/lite.h index da6eb63..5fdc429 100644 --- a/lite.h +++ b/lite.h @@ -86,10 +86,15 @@ void progress (int percent, int max_width); void progress_simple(int percent); #ifndef touch +#include /* utimensat() */ +#include /* utimensat() on *BSD */ static inline int touch(const char *path) { - if (mknod((path), S_IFREG|0644, 0) && errno != EEXIST) + if (mknod((path), S_IFREG|0644, 0)) { + if (errno == EEXIST) + return utimensat(0, path, NULL, 0); return -1; + } return 0; } #endif