chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sysv: allow configuration of SysV start priority from new-style service files, too
[elogind.git]
/
main.c
diff --git
a/main.c
b/main.c
index 830a9a43eb9ea830b39a95d2629fbba49abdb791..838f5c89e3812a97e21503a000329af5d9f4c0cb 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-34,11
+34,15
@@
int main(int argc, char *argv[]) {
Unit *target = NULL;
Job *job = NULL;
int r, retval = 1;
Unit *target = NULL;
Job *job = NULL;
int r, retval = 1;
+ const char *default_unit;
- assert_se(set_unit_path("test1") >= 0);
+ if (argc >= 2)
+ default_unit = argv[1];
+ else
+ default_unit = SPECIAL_DEFAULT_TARGET;
- if (
!(m = manager_new())
) {
- log_error("Failed to allocate manager object: %s", strerror(
ENOMEM
));
+ if (
(r = manager_new(&m)) < 0
) {
+ log_error("Failed to allocate manager object: %s", strerror(
-r
));
goto finish;
}
goto finish;
}
@@
-47,7
+51,9
@@
int main(int argc, char *argv[]) {
goto finish;
}
goto finish;
}
- if ((r = manager_load_unit(m, SPECIAL_DEFAULT_TARGET, &target)) < 0) {
+ log_debug("Activating default unit: %s", default_unit);
+
+ if ((r = manager_load_unit(m, default_unit, &target)) < 0) {
log_error("Failed to load default target: %s", strerror(-r));
goto finish;
}
log_error("Failed to load default target: %s", strerror(-r));
goto finish;
}