chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
execute: when running in session mode, still enforce proper ordering of logger socket
[elogind.git]
/
unit.c
diff --git
a/unit.c
b/unit.c
index 980c3711eb147d60075c416643d54e74bd57f69a..39c9e5e7e83d86156ca6440a67bbf8ddae706c97 100644
(file)
--- a/
unit.c
+++ b/
unit.c
@@
-1001,10
+1001,10
@@
int set_unit_path(const char *p) {
return 0;
}
return 0;
}
-char *unit_name_escape_path(const char *p
refix, const char *p
ath, const char *suffix) {
+char *unit_name_escape_path(const char *path, const char *suffix) {
char *r, *t;
const char *f;
char *r, *t;
const char *f;
- size_t a, b
, c
;
+ size_t a, b;
assert(path);
assert(path);
@@
-1017,22
+1017,16
@@
char *unit_name_escape_path(const char *prefix, const char *path, const char *su
* escaping is hence reversible.
*/
* escaping is hence reversible.
*/
- if (!prefix)
- prefix = "";
-
if (!suffix)
suffix = "";
if (!suffix)
suffix = "";
- a = strlen(prefix);
- b = strlen(path);
- c = strlen(suffix);
+ a = strlen(path);
+ b = strlen(suffix);
- if (!(r = new(char, a
+b*4+c
+1)))
+ if (!(r = new(char, a
*4+b
+1)))
return NULL;
return NULL;
- memcpy(r, prefix, a);
-
- for (f = path, t = r+a; *f; f++) {
+ for (f = path, t = r; *f; f++) {
if (*f == '/')
*(t++) = '.';
else if (*f == '.' || *f == '\\' || !strchr(VALID_CHARS, *f)) {
if (*f == '/')
*(t++) = '.';
else if (*f == '.' || *f == '\\' || !strchr(VALID_CHARS, *f)) {
@@
-1044,7
+1038,7
@@
char *unit_name_escape_path(const char *prefix, const char *path, const char *su
*(t++) = *f;
}
*(t++) = *f;
}
- memcpy(t, suffix,
c
+1);
+ memcpy(t, suffix,
b
+1);
return r;
}
return r;
}