Silence warning in digest_matches() on systems with no fexecve(2).
This commit is contained in:
@@ -590,8 +590,10 @@ digest_matches(const char *file, const struct sudo_digest *sd, int *fd)
|
|||||||
unsigned char sudoers_digest[SHA512_DIGEST_LENGTH];
|
unsigned char sudoers_digest[SHA512_DIGEST_LENGTH];
|
||||||
unsigned char buf[32 * 1024];
|
unsigned char buf[32 * 1024];
|
||||||
struct digest_function *func = NULL;
|
struct digest_function *func = NULL;
|
||||||
|
#ifdef HAVE_FEXECVE
|
||||||
bool first = true;
|
bool first = true;
|
||||||
bool is_script = false;
|
bool is_script = false;
|
||||||
|
#endif /* HAVE_FEXECVE */
|
||||||
size_t nread;
|
size_t nread;
|
||||||
SHA2_CTX ctx;
|
SHA2_CTX ctx;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -635,12 +637,14 @@ digest_matches(const char *file, const struct sudo_digest *sd, int *fd)
|
|||||||
|
|
||||||
func->init(&ctx);
|
func->init(&ctx);
|
||||||
while ((nread = fread(buf, 1, sizeof(buf), fp)) != 0) {
|
while ((nread = fread(buf, 1, sizeof(buf), fp)) != 0) {
|
||||||
|
#ifdef HAVE_FEXECVE
|
||||||
/* Check for #! cookie and set is_script. */
|
/* Check for #! cookie and set is_script. */
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
if (nread >= 2 && buf[0] == '#' && buf[1] == '!')
|
if (nread >= 2 && buf[0] == '#' && buf[1] == '!')
|
||||||
is_script = true;
|
is_script = true;
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_FEXECVE */
|
||||||
func->update(&ctx, buf, nread);
|
func->update(&ctx, buf, nread);
|
||||||
}
|
}
|
||||||
if (ferror(fp)) {
|
if (ferror(fp)) {
|
||||||
|
Reference in New Issue
Block a user