Restore old behavior where visudo prevents you from making the main
sudoers file zero length.
This commit is contained in:
@@ -451,10 +451,12 @@ edit_sudoers(struct sudoersfile *sp, char *editor, char *args, int lineno)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (sb.st_size == 0 && orig_size != 0) {
|
if (sb.st_size == 0 && orig_size != 0) {
|
||||||
sudo_warnx(U_("zero length temporary file (%s), %s unchanged"),
|
/* Avoid accidental zeroing of main sudoers file. */
|
||||||
sp->tpath, sp->path);
|
if (sp == TAILQ_FIRST(&sudoerslist)) {
|
||||||
sp->modified = true;
|
sudo_warnx(U_("zero length temporary file (%s), %s unchanged"),
|
||||||
goto done;
|
sp->tpath, sp->path);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sudo_warnx(U_("editor (%s) failed, %s unchanged"), editor, sp->path);
|
sudo_warnx(U_("editor (%s) failed, %s unchanged"), editor, sp->path);
|
||||||
|
Reference in New Issue
Block a user