chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
systemctl: suppress duplicate newline if there's not log output in "systemctl status"
[elogind.git]
/
src
/
shared
/
path-util.c
diff --git
a/src/shared/path-util.c
b/src/shared/path-util.c
index 384386177947fdb7cc9c14df1942949a88a17631..bdc54a9aa5f9a23d0dbfd89bcc801eee14564df3 100644
(file)
--- a/
src/shared/path-util.c
+++ b/
src/shared/path-util.c
@@
-153,7
+153,7
@@
char **path_strv_make_absolute_cwd(char **l) {
return l;
}
return l;
}
-char **path_strv_canonicalize
(char **l
) {
+char **path_strv_canonicalize
_absolute(char **l, const char *prefix
) {
char **s;
unsigned k = 0;
bool enomem = false;
char **s;
unsigned k = 0;
bool enomem = false;
@@
-168,13
+168,21
@@
char **path_strv_canonicalize(char **l) {
STRV_FOREACH(s, l) {
char *t, *u;
STRV_FOREACH(s, l) {
char *t, *u;
- t = path_make_absolute_cwd(*s);
- free(*s);
- *s = NULL;
-
- if (!t) {
- enomem = true;
+ if (!path_is_absolute(*s))
continue;
continue;
+
+ if (prefix) {
+ t = strappend(prefix, *s);
+ free(*s);
+ *s = NULL;
+
+ if (!t) {
+ enomem = true;
+ continue;
+ }
+ } else {
+ t = *s;
+ *s = NULL;
}
errno = 0;
}
errno = 0;
@@
-184,7
+192,7
@@
char **path_strv_canonicalize(char **l) {
u = t;
else {
free(t);
u = t;
else {
free(t);
- if (errno == ENOMEM ||
!errno
)
+ if (errno == ENOMEM ||
errno == 0
)
enomem = true;
continue;
enomem = true;
continue;
@@
-203,11
+211,12
@@
char **path_strv_canonicalize(char **l) {
return l;
}
return l;
}
-char **path_strv_canonicalize_uniq(char **l) {
+char **path_strv_canonicalize_absolute_uniq(char **l, const char *prefix) {
+
if (strv_isempty(l))
return l;
if (strv_isempty(l))
return l;
- if (!path_strv_canonicalize
(l
))
+ if (!path_strv_canonicalize
_absolute(l, prefix
))
return NULL;
return strv_uniq(l);
return NULL;
return strv_uniq(l);
@@
-464,9
+473,9
@@
int find_binary(const char *name, char **filename) {
}
}
}
}
-bool paths_check_timestamp(c
har **
paths, usec_t *timestamp, bool update) {
+bool paths_check_timestamp(c
onst char* const*
paths, usec_t *timestamp, bool update) {
bool changed = false;
bool changed = false;
- c
har **
i;
+ c
onst char* const*
i;
assert(timestamp);
assert(timestamp);
@@
-486,7
+495,7
@@
bool paths_check_timestamp(char **paths, usec_t *timestamp, bool update) {
if (*timestamp >= u)
continue;
if (*timestamp >= u)
continue;
- log_debug("timestamp of '%s' changed
\n
", *i);
+ log_debug("timestamp of '%s' changed", *i);
/* update timestamp */
if (update) {
/* update timestamp */
if (update) {