char *d = NULL;
if (chkconfig_description)
- asprintf(&d, "%s %s", chkconfig_description, j);
+ d = join(chkconfig_description, " ", j, NULL);
else
d = strdup(j);
char *d = NULL;
if (long_description)
- asprintf(&d, "%s %s", long_description, t);
+ d = join(long_description, " ", t, NULL);
else
d = strdup(j);
char *path;
int r;
- if (asprintf(&path, "%s/%s", *p, name) < 0)
+ path = join(*p, "/", name, NULL);
+ if (!path)
return -ENOMEM;
assert(endswith(path, ".service"));
if (r >= 0 && s->meta.load_state == UNIT_STUB) {
/* Try SUSE style boot.* init scripts */
- if (asprintf(&path, "%s/boot.%s", *p, name) < 0)
+ path = join(*p, "/boot.", name, NULL);
+ if (!path)
return -ENOMEM;
/* Drop .service suffix */
if (r >= 0 && s->meta.load_state == UNIT_STUB) {
/* Try Frugalware style rc.* init scripts */
- if (asprintf(&path, "%s/rc.%s", *p, name) < 0)
+ path = join(*p, "/rc.", name, NULL);
+ if (!path)
return -ENOMEM;
/* Drop .service suffix */
struct dirent *de;
free(path);
- path = NULL;
path = join(*p, "/", rcnd_table[i].path, NULL);
if (!path) {
r = -ENOMEM;
continue;
free(fpath);
- fpath = NULL;
- if (asprintf(&fpath, "%s/%s/%s", *p, rcnd_table[i].path, de->d_name) < 0) {
+ fpath = join(path, "/", de->d_name, NULL);
+ if (!path) {
r = -ENOMEM;
goto finish;
}
const char *separator, ...) {
int r = 0;
- char *contents, *p;
+ char *contents = NULL, *p;
assert(fname);
assert(separator);
}
char *path_make_absolute(const char *p, const char *prefix) {
- char *r;
-
assert(p);
/* Makes every item in the list an absolute path by prepending
if (path_is_absolute(p) || !prefix)
return strdup(p);
- if (asprintf(&r, "%s/%s", prefix, p) < 0)
- return NULL;
-
- return r;
+ return join(prefix, "/", p, NULL);
}
char *path_make_absolute_cwd(const char *p) {