Skip to content

Commit

Permalink
Fix broken chmod in open_logfile().
Browse files Browse the repository at this point in the history
gcc (Debian 12.2.0-14) 12.2.0

sn_logfile.c:96:8: warning: passing argument 1 of 'fchmod' makes integer
  from pointer without a cast [-Wint-conversion]

fchmod() takes a file descriptor, not a pointer to FILE, so the call to
fchmod() always failed.  In order not to involve fileno(), just use
chmod(), which takes a pathname, which the function already knows.
  • Loading branch information
infrastation committed Sep 18, 2024
1 parent fd71f89 commit 7e67b9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sn_logfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ LogFILE=fopen(Logfile,"a");
if(LogFILE==NULL)
printf("Sniffit heartattack.. couldn't create/open logfile...\n"), exit(1);
exit_func(logfile_exit);
fchmod(LogFILE, S_IWUSR|S_IRUSR);
chmod(Logfile, S_IWUSR|S_IRUSR);
print_logline("Sniffit session started.");
printf("Sniffit Logging started.\n");
}
Expand Down

0 comments on commit 7e67b9a

Please sign in to comment.