mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 14:25:15 +00:00
Shift return value of system(3) by 8 to get real exit value and if it is not 1 or 0 print the retval along with the error message.
This commit is contained in:
9
visudo.c
9
visudo.c
@@ -231,9 +231,9 @@ int main(argc, argv)
|
||||
else
|
||||
(void) sprintf(buf, "%s %s", Editor, stmp);
|
||||
|
||||
/* do the edit -- some SYSV editors return 256 instead of 0 */
|
||||
/* do the edit -- some SYSV editors exit with 1 instead of 0 */
|
||||
n = system(buf);
|
||||
if (n == 0 || n == 256) {
|
||||
if (n != -1 && ((n >> 8) == 0 || (n >> 8) == 1)) {
|
||||
struct stat statbuf; /* for sanity checking */
|
||||
|
||||
/* make sure stmp exists */
|
||||
@@ -279,8 +279,9 @@ int main(argc, argv)
|
||||
parse_error = TRUE;
|
||||
}
|
||||
} else {
|
||||
(void) fprintf(stderr, "%s: Editor (%s) failed, %s unchanged.\n",
|
||||
Argv[0], Editor, sudoers);
|
||||
(void) fprintf(stderr,
|
||||
"%s: Editor (%s) failed with exit status %d, %s unchanged.\n",
|
||||
Argv[0], Editor, n, sudoers);
|
||||
Exit(-1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user