diff options
author | Daniel Mack <github@zonque.org> | 2015-07-24 00:04:49 +0200 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-07-24 00:04:49 +0200 |
commit | 39109ec08d6611f299d550ce77f9896b0f9394e4 (patch) | |
tree | 1ced6a47126a2a8d1a6f7bc1ecad1f318ec33b93 /src/basic/fileio.c | |
parent | 6fa7ec3b6bf182e1bf2def75d0158888c0b189c9 (diff) | |
parent | 03c55bc0b980e2a6aaf6f166a9271ed8ecce2222 (diff) |
Merge pull request #694 from poettering/fileio-fixes
Fileio fixes
Diffstat (limited to 'src/basic/fileio.c')
-rw-r--r-- | src/basic/fileio.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/basic/fileio.c b/src/basic/fileio.c index d592bf5ac9..2216853777 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -786,7 +786,7 @@ int executable_is_script(const char *path, char **interpreter) { */ int get_status_field(const char *filename, const char *pattern, char **field) { _cleanup_free_ char *status = NULL; - char *t; + char *t, *f; size_t len; int r; @@ -820,9 +820,10 @@ int get_status_field(const char *filename, const char *pattern, char **field) { len = strcspn(t, WHITESPACE); - *field = strndup(t, len); - if (!*field) + f = strndup(t, len); + if (!f) return -ENOMEM; + *field = f; return 0; } |