This file is part of systemd.
Copyright 2012 Zbigniew Jędrzejewski-Szmek
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <fcntl.h>
static int add_match(sd_journal *j, const char *match) {
_cleanup_free_ char *p = NULL;
- char *pattern = NULL;
- const char* prefix;
+ const char* prefix, *pattern;
pid_t pid;
int r;
r = sd_journal_add_match(j, pattern, 0);
if (r < 0)
return log_error_errno(r, "Failed to add match \"%s\": %m", match);
+
return 0;
}
log_debug("Journal filter: %s", filter);
}
- *ret = j;
- j = NULL;
+ *ret = TAKE_PTR(j);
return 0;
}
if (r < 0)
return r;
- pager_open(arg_no_pager, false);
+ (void) pager_open(arg_no_pager, false);
/* The coredumps are likely to compressed, and for just
* listing them we don't need to decompress them, so let's
return log_error_errno(errno, "File \"%s\" is not readable: %m", filename);
if (path && !endswith(filename, ".xz") && !endswith(filename, ".lz4")) {
- *path = filename;
- filename = NULL;
+ *path = TAKE_PTR(filename);
return 0;
}
end:
pager_close();
- if (arg_output)
- fclose(arg_output);
+ safe_fclose(arg_output);
return r >= 0 ? r : EXIT_FAILURE;
}