Skip to content

Commit

Permalink
give those if's a bit more space to breath
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Zimmermann committed Jan 12, 2025
1 parent 70fcb96 commit 66a291c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions elkscmd/file_utils/mknod.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ int main(int argc, char **argv)
if (argv[1] && argv[1][0] == '-' && argv[1][1] == 'p') {
/* preserve option */
struct stat sb;
if(stat(argv[2], &sb) == 0) {
if(S_ISCHR(sb.st_mode) && argv[3] && (argv[3][0] == 'c' || argv[3][0] == 'u')) return 1;
if(S_ISBLK(sb.st_mode) && argv[3] && argv[3][0] == 'b') return 1;
if(S_ISFIFO(sb.st_mode) && argv[3] && argv[3][0] == 'p') return 1;
if (stat(argv[2], &sb) == 0) {
if (S_ISCHR(sb.st_mode) && argv[3] && (argv[3][0] == 'c' || argv[3][0] == 'u')) return 1;
if (S_ISBLK(sb.st_mode) && argv[3] && argv[3][0] == 'b') return 1;
if (S_ISFIFO(sb.st_mode) && argv[3] && argv[3][0] == 'p') return 1;
}
/* valid node not there yet, so we advance and create it */
argc--;
Expand Down

0 comments on commit 66a291c

Please sign in to comment.