summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-30 15:44:29 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:49:53 +0200
commit186497534baebff85a9413f50a26eaf98520b63d (patch)
treeb5b52fb6670c397adc9655b6fbec65c5d040c3f8
parent6eeef058d5cb544c567ebc53b8e02d67d33080c9 (diff)
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".
-rw-r--r--src/basic/fileio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index 8b00fc817..8906c0b82 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -929,14 +929,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;