Use uid_t to avoid signed comparison warning, output diagnostic messages to stderr
This commit is contained in:
parent
54ef14ba94
commit
8260b0af7f
1 changed files with 5 additions and 5 deletions
6
kissy.c
6
kissy.c
|
|
@ -53,7 +53,7 @@ int main (int argc, char **argv) {
|
||||||
printf("%s\n", "Cannot find target");
|
printf("%s\n", "Cannot find target");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
int target = pw->pw_uid;
|
uid_t target = pw->pw_uid;
|
||||||
|
|
||||||
// get current username
|
// get current username
|
||||||
struct passwd *pw2 = getpwuid(getuid());
|
struct passwd *pw2 = getpwuid(getuid());
|
||||||
|
|
@ -90,7 +90,7 @@ int main (int argc, char **argv) {
|
||||||
kissed = true;
|
kissed = true;
|
||||||
|
|
||||||
if (stats.st_gid != getegid()) { // are we running as the tty user?
|
if (stats.st_gid != getegid()) { // are we running as the tty user?
|
||||||
printf("%s\n", "Mismatch between file owner group and current effective group. Make sure this program is running with setgid.");
|
fprintf(stderr, "%s\n", "Mismatch between file owner group and current effective group. Make sure this program is running with setgid.");
|
||||||
} else {
|
} else {
|
||||||
FILE *tty = fopen(filepath, "a"); // write to terminal!
|
FILE *tty = fopen(filepath, "a"); // write to terminal!
|
||||||
fprintf(tty, "\n%s\n--%s\n", kiss, user);
|
fprintf(tty, "\n%s\n--%s\n", kiss, user);
|
||||||
|
|
@ -101,5 +101,5 @@ int main (int argc, char **argv) {
|
||||||
|
|
||||||
// print a message if a suitable terminal couldn't be found
|
// print a message if a suitable terminal couldn't be found
|
||||||
if (!kissed)
|
if (!kissed)
|
||||||
printf("%s\n", "Couldn't find any suitable terminals. User is not logged in or has not enabled messages.");
|
fprintf(stderr, "%s\n", "Couldn't find any suitable terminals. User is not logged in or has not enabled messages.");
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue