fileio: minor tweak to executable_is_script()

If read_line() returns ENOBFUS this means the line was overly long. When
we use this for checking whether an executable is a script, then this
shouldn't be propagated as-is, but simply as "this is not a script".
This commit is contained in:
Lennart Poettering 2017-12-30 15:44:29 +01:00
parent 91dc2bf74d
commit 99c61f6b00
1 changed files with 4 additions and 2 deletions

View File

@ -926,14 +926,16 @@ int write_env_file(const char *fname, char **l) {
}
int executable_is_script(const char *path, char **interpreter) {
int r;
_cleanup_free_ char *line = NULL;
int len;
size_t len;
char *ans;
int r;
assert(path);
r = read_one_line_file(path, &line);
if (r == -ENOBUFS) /* First line overly long? if so, then it's not a script */
return 0;
if (r < 0)
return r;