Only "y" and "n" are valid, nothing else

Good catch FRIGN.
This commit is contained in:
sin 2014-07-26 15:51:21 +01:00
parent 60b1cc522e
commit bf9dfd7b29
1 changed files with 2 additions and 2 deletions

4
mesg.c
View File

@ -39,9 +39,9 @@ main(int argc, char *argv[])
return EXIT_SUCCESS;
}
if (argv[0][0] == 'y')
if (argv[0][0] == 'y' && argv[0][1] == '\0')
mode = sb.st_mode | S_IWGRP | S_IWOTH;
else if (argv[0][0] == 'n')
else if (argv[0][0] == 'n' && argv[0][1] == '\0')
mode = sb.st_mode & ~(S_IWGRP | S_IWOTH);
else
usage();