stat-util: unify code that checks whether something is a regular file

Let's add a common implementation for regular file checks, that are
careful to return the right error code (EISDIR/EISLNK/EBADFD) when we
are encountering a wrong file node.
This commit is contained in:
Lennart Poettering
2018-02-20 15:39:31 +01:00
parent 9c66f52813
commit 3cc4411403
8 changed files with 73 additions and 58 deletions
+3
View File
@@ -75,3 +75,6 @@ int path_is_temporary_fs(const char *path);
* signed/unsigned comparison, because the magic can be 32 bit unsigned.
*/
#define F_TYPE_EQUAL(a, b) (a == (typeof(a)) b)
int stat_verify_regular(const struct stat *st);
int fd_verify_regular(int fd);