From: Lennart Poettering Date: Sat, 30 Dec 2017 14:44:29 +0000 (+0100) Subject: fileio: minor tweak to executable_is_script() X-Git-Tag: v237~146^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=99c61f6b00f0544a61dd45536de8c92cbc91d9a7;p=thirdparty%2Fsystemd.git 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". --- diff --git a/src/basic/fileio.c b/src/basic/fileio.c index 7d71a3e9853..430851cc8ca 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -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;