Skip to content

Commit

Permalink
iamroot: rename __{,f}is{directory,file,symlink}()
Browse files Browse the repository at this point in the history
  • Loading branch information
gportay committed Mar 19, 2024
1 parent a6fdad7 commit 177c55f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
18 changes: 9 additions & 9 deletions iamroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int _snprintf(char *buf, size_t bufsiz, const char *fmt, ...)
}

__attribute__((visibility("hidden")))
int __fissymlinkat(int dfd, const char *path, int atflags)
int __fis_symlinkat(int dfd, const char *path, int atflags)
{
struct stat statbuf;
int ret;
Expand All @@ -114,7 +114,7 @@ int __fissymlinkat(int dfd, const char *path, int atflags)

#ifndef __NetBSD__
__attribute__((visibility("hidden")))
int __fissymlink(int fd)
int __fis_symlink(int fd)
{
struct stat statbuf;
int ret;
Expand All @@ -128,7 +128,7 @@ int __fissymlink(int fd)
#endif

__attribute__((visibility("hidden")))
int __issymlink(const char *path)
int __is_symlink(const char *path)
{
struct stat statbuf;
int ret;
Expand All @@ -141,7 +141,7 @@ int __issymlink(const char *path)
}

__attribute__((visibility("hidden")))
int __fisdirectoryat(int dfd, const char *path, int atflags)
int __fis_directoryat(int dfd, const char *path, int atflags)
{
struct stat statbuf;
int ret;
Expand All @@ -154,7 +154,7 @@ int __fisdirectoryat(int dfd, const char *path, int atflags)
}

__attribute__((visibility("hidden")))
int __isdirectory(const char *path)
int __is_directory(const char *path)
{
struct stat statbuf;
int ret;
Expand All @@ -168,7 +168,7 @@ int __isdirectory(const char *path)

#ifndef __NetBSD__
__attribute__((visibility("hidden")))
int __fisdirectory(int fd)
int __fis_directory(int fd)
{
struct stat statbuf;
int ret;
Expand All @@ -182,7 +182,7 @@ int __fisdirectory(int fd)
#endif

__attribute__((visibility("hidden")))
int __fisfileat(int dfd, const char *path, int atflags)
int __fis_fileat(int dfd, const char *path, int atflags)
{
struct stat statbuf;
int ret;
Expand All @@ -196,7 +196,7 @@ int __fisfileat(int dfd, const char *path, int atflags)

#ifndef __NetBSD__
__attribute__((visibility("hidden")))
int __fisfile(int fd)
int __fis_file(int fd)
{
struct stat statbuf;
int ret;
Expand All @@ -210,7 +210,7 @@ int __fisfile(int fd)
#endif

__attribute__((visibility("hidden")))
int __isfile(const char *path)
int __is_file(const char *path)
{
struct stat statbuf;
int ret;
Expand Down
24 changes: 12 additions & 12 deletions iamroot.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ int _setenv(const char *, const char *, int);
int _unsetenv(const char *);
int _snprintf(char *, size_t, const char *, ...) __attribute__((format(printf,3,4)));

int __fissymlinkat(int, const char *, int);
int __fissymlink(int);
int __issymlink(const char *);
int __fisdirectoryat(int, const char *, int);
int __fisdirectory(int);
int __isdirectory(const char *);
int __fisfileat(int, const char *, int);
int __fisfile(int);
int __isfile(const char *);
int __fis_symlinkat(int, const char *, int);
int __fis_symlink(int);
int __is_symlink(const char *);
int __fis_directoryat(int, const char *, int);
int __fis_directory(int);
int __is_directory(const char *);
int __fis_fileat(int, const char *, int);
int __fis_file(int);
int __is_file(const char *);
const char *__basename(const char *);
char *__getenv(const char *);
int __setenv(const char *, const char *, int);
Expand Down Expand Up @@ -280,14 +280,14 @@ void __verbose_exec(char * const[], char * const[]);
} })

#define __fwarn_if_insuffisant_user_mode(fd, mode) \
({ if (__fisdirectory((fd)) > 0) { \
({ if (__fis_directory((fd)) > 0) { \
__fwarn_and_set_user_mode((fd), (mode), 0700); \
} else { \
__fwarn_and_set_user_mode((fd), (mode), 0600); \
} })

#define __fwarn_if_insuffisant_user_modeat(fd, path, mode, flags) \
({ if (__fisdirectoryat((fd), (path), (flags)) > 0) { \
({ if (__fis_directoryat((fd), (path), (flags)) > 0) { \
__fwarn_and_set_user_modeat((fd), (path), (mode), (flags), 0700); \
} else { \
__fwarn_and_set_user_modeat((fd), (path), (mode), (flags), 0600); \
Expand All @@ -308,7 +308,7 @@ void __verbose_exec(char * const[], char * const[]);
} })

#define __warn_if_insuffisant_user_mode(path, mode) \
({ if (__isdirectory((path)) > 0) { \
({ if (__is_directory((path)) > 0) { \
__warn_and_set_user_mode((path), (mode), 0700); \
} else { \
__warn_and_set_user_mode((path), (mode), 0600); \
Expand Down

0 comments on commit 177c55f

Please sign in to comment.