aboutsummaryrefslogtreecommitdiff
path: root/src/io.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-12-21 12:18:46 +0100
committerAdrian Kummerlaender2015-12-21 12:18:46 +0100
commitb02091f847b94e94db465469e723fcf2aee81a01 (patch)
tree25206750bd201434c859b084eda4be3263d88873 /src/io.h
parent30d28c558015afe22822647cc3943e2afb14afde (diff)
downloadchange-b02091f847b94e94db465469e723fcf2aee81a01.tar
change-b02091f847b94e94db465469e723fcf2aee81a01.tar.gz
change-b02091f847b94e94db465469e723fcf2aee81a01.tar.bz2
change-b02091f847b94e94db465469e723fcf2aee81a01.tar.lz
change-b02091f847b94e94db465469e723fcf2aee81a01.tar.xz
change-b02091f847b94e94db465469e723fcf2aee81a01.tar.zst
change-b02091f847b94e94db465469e723fcf2aee81a01.zip
Add file mode check in `unlink`
Diffstat (limited to 'src/io.h')
-rw-r--r--src/io.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/io.h b/src/io.h
index 676ebac..69caa5e 100644
--- a/src/io.h
+++ b/src/io.h
@@ -56,6 +56,13 @@ bool is_regular_file(int fd) {
return S_ISREG(fd_stat.st_mode);
}
+bool is_regular_file(const char* path) {
+ struct stat fd_stat;
+ lstat(path, &fd_stat);
+
+ return S_ISREG(fd_stat.st_mode);
+}
+
}
#endif // CHANGE_SRC_IO_H_