summaryrefslogtreecommitdiff
path: root/src/instcheck.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
commita6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (patch)
treeb88cc7a8457658d67e0321718556ac807f6bccf3 /src/instcheck.c
parent00be7622c428f279872f84569f098ce16150f8a8 (diff)
format files
Diffstat (limited to 'src/instcheck.c')
-rw-r--r--src/instcheck.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/src/instcheck.c b/src/instcheck.c
index e47da87..126ad11 100644
--- a/src/instcheck.c
+++ b/src/instcheck.c
@@ -1,69 +1,66 @@
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
-#include "logmsg.h"
+
#include "exit.h"
+#include "logmsg.h"
+
#include "hier.h"
extern void hier();
#define WHO "instcheck"
-void perm(char *prefix1,char *prefix2,char *prefix3,char *file,int type,int uid,int gid,int mode)
+void perm(char *prefix1, char *prefix2, char *prefix3, char *file, int type, int uid, int gid, int mode)
{
struct stat st;
- if (stat(file,&st) == -1) {
+ if (stat(file, &st) == -1) {
if (errno == ENOENT)
- logmsg(WHO,0,WARN,B("file does nost exist:",prefix1,prefix2,prefix3,file));
+ logmsg(WHO, 0, WARN, B("file does nost exist:", prefix1, prefix2, prefix3, file));
else
- logmsg(WHO,errno,WARN,B("unable to stat: ../",file));
+ logmsg(WHO, errno, WARN, B("unable to stat: ../", file));
return;
}
if ((uid != -1) && (st.st_uid != uid))
- logmsg(WHO,0,WARN,B("file has wrong owner: ",prefix1,prefix2,prefix3,file));
+ logmsg(WHO, 0, WARN, B("file has wrong owner: ", prefix1, prefix2, prefix3, file));
if ((gid != -1) && (st.st_gid != gid))
- logmsg(WHO,0,WARN,B("file has wrong group: ",prefix1,prefix2,prefix3,file));
+ logmsg(WHO, 0, WARN, B("file has wrong group: ", prefix1, prefix2, prefix3, file));
if ((st.st_mode & 07777) != mode)
- logmsg(WHO,0,WARN,B("file has wrong permissions: ",prefix1,prefix2,prefix3,file));
+ logmsg(WHO, 0, WARN, B("file has wrong permissions: ", prefix1, prefix2, prefix3, file));
if ((st.st_mode & S_IFMT) != type)
- logmsg(WHO,0,WARN,B("file has wrong type: ",prefix1,prefix2,prefix3,file));
+ logmsg(WHO, 0, WARN, B("file has wrong type: ", prefix1, prefix2, prefix3, file));
}
-void h(char *home,int uid,int gid,int mode)
+void h(char *home, int uid, int gid, int mode)
{
- perm("","","",home,S_IFDIR,uid,gid,mode);
+ perm("", "", "", home, S_IFDIR, uid, gid, mode);
}
-void d(char *home,char *subdir,int uid,int gid,int mode)
+void d(char *home, char *subdir, int uid, int gid, int mode)
{
- if (chdir(home) == -1)
- logmsg(WHO,111,FATAL,B("unable to switch to: ",home));
- perm("",home,"/",subdir,S_IFDIR,uid,gid,mode);
+ if (chdir(home) == -1) logmsg(WHO, 111, FATAL, B("unable to switch to: ", home));
+ perm("", home, "/", subdir, S_IFDIR, uid, gid, mode);
}
-void p(char *home,char *fifo,int uid,int gid,int mode)
+void p(char *home, char *fifo, int uid, int gid, int mode)
{
- if (chdir(home) == -1)
- logmsg(WHO,111,FATAL,B("unable to switch to: ",home));
- perm("",home,"/",fifo,S_IFIFO,uid,gid,mode);
+ if (chdir(home) == -1) logmsg(WHO, 111, FATAL, B("unable to switch to: ", home));
+ perm("", home, "/", fifo, S_IFIFO, uid, gid, mode);
}
-void c(char *home,char *subdir,char *file,int uid,int gid,int mode)
+void c(char *home, char *subdir, char *file, int uid, int gid, int mode)
{
- if (chdir(home) == -1)
- logmsg(WHO,111,FATAL,B("unable to switch to: ",home));
- if (chdir(subdir) == -1)
- logmsg(WHO,111,FATAL,B("unable to switch to: ",home,"/",subdir));
- perm(".../",subdir,"/",file,S_IFREG,uid,gid,mode);
+ if (chdir(home) == -1) logmsg(WHO, 111, FATAL, B("unable to switch to: ", home));
+ if (chdir(subdir) == -1) logmsg(WHO, 111, FATAL, B("unable to switch to: ", home, "/", subdir));
+ perm(".../", subdir, "/", file, S_IFREG, uid, gid, mode);
}
-void z(char *home,char *file,int len,int uid,int gid,int mode)
+void z(char *home, char *file, int len, int uid, int gid, int mode)
{
- if (chdir(home) == -1)
- logmsg(WHO,111,FATAL,B("unable to switch to: ",home));
- perm("",home,"/",file,S_IFREG,uid,gid,mode);
+ if (chdir(home) == -1) logmsg(WHO, 111, FATAL, B("unable to switch to: ", home));
+ perm("", home, "/", file, S_IFREG, uid, gid, mode);
}
int main()