along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "systemd/sd-id128.h"
#include "unit.h"
#include "specifier.h"
-#include "path-util.h"
#include "strv.h"
#include "unit-name.h"
#include "unit-printf.h"
#include "macro.h"
#include "cgroup-util.h"
-#include "special.h"
static int specifier_prefix_and_instance(char specifier, void *data, void *userdata, char **ret) {
Unit *u = userdata;
assert(u);
if (!u->instance)
- return -ENOTSUP;
+ return -EOPNOTSUPP;
n = unit_name_unescape(u->instance);
if (!n)
else {
e = getenv("XDG_RUNTIME_DIR");
if (!e)
- return -ENOTSUP;
+ return -EOPNOTSUPP;
}
n = strdup(e);
char *printed = NULL;
Unit *u = userdata;
ExecContext *c;
- int r;
+ int r = 0;
assert(u);
c = unit_get_exec_context(u);
if (!c)
- return -ENOTSUP;
+ return -EOPNOTSUPP;
if (u->manager->running_as == SYSTEMD_SYSTEM) {
if (r < 0)
return -ENODATA;
- asprintf(&printed, "%lu", (unsigned long) uid);
+ r = asprintf(&printed, UID_FMT, uid);
}
}
if (specifier == 'u')
printed = strdup(username);
else
- asprintf(&printed, "%lu", (unsigned long) uid);
+ r = asprintf(&printed, UID_FMT, uid);
}
- if (!printed)
+ if (r < 0 || !printed)
return -ENOMEM;
*ret = printed;
c = unit_get_exec_context(u);
if (!c)
- return -ENOTSUP;
+ return -EOPNOTSUPP;
if (u->manager->running_as == SYSTEMD_SYSTEM) {
if (!c->user || streq(c->user, "root") || streq(c->user, "0"))
n = strdup("/root");
else
- return -ENOTSUP;
+ return -EOPNOTSUPP;
} else {
c = unit_get_exec_context(u);
if (!c)
- return -ENOTSUP;
+ return -EOPNOTSUPP;
if (u->manager->running_as == SYSTEMD_SYSTEM) {
if (!c->user || streq(c->user, "root") || streq(c->user, "0"))
n = strdup("/bin/sh");
else
- return -ENOTSUP;
+ return -EOPNOTSUPP;
} else {