chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dropin: don't fail if random files are stored in .wants directories
[elogind.git]
/
src
/
getty-generator.c
diff --git
a/src/getty-generator.c
b/src/getty-generator.c
index f49f9eae99df54a108659064157932bfb939df4d..14cceb49c880198ff0b0f50bc2ac95b154fbb8a5 100644
(file)
--- a/
src/getty-generator.c
+++ b/
src/getty-generator.c
@@
-44,9
+44,15
@@
static int add_symlink(const char *fservice, const char *tservice) {
mkdir_parents(to, 0755);
mkdir_parents(to, 0755);
- if ((r = symlink(from, to)) < 0) {
- log_error("Failed to create symlink from %s to %s: %m", from, to);
- r = -errno;
+ r = symlink(from, to);
+ if (r < 0) {
+ if (errno == EEXIST)
+ /* In case console=hvc is passed this will very likely result in EEXIST */
+ r = 0;
+ else {
+ log_error("Failed to create symlink from %s to %s: %m", from, to);
+ r = -errno;
+ }
}
finish:
}
finish:
@@
-73,8
+79,10
@@
int main(int argc, char *argv[]) {
log_parse_environment();
log_open();
log_parse_environment();
log_open();
+ umask(0022);
+
if (detect_container(NULL) > 0) {
if (detect_container(NULL) > 0) {
- log_debug("Automatic adding console shell.");
+ log_debug("Automatic
ally
adding console shell.");
if (add_symlink("console-shell.service", "console-shell.service") < 0)
r = EXIT_FAILURE;
if (add_symlink("console-shell.service", "console-shell.service") < 0)
r = EXIT_FAILURE;
@@
-86,8
+94,8
@@
int main(int argc, char *argv[]) {
if (read_one_line_file("/sys/class/tty/console/active", &active) >= 0) {
const char *tty;
if (read_one_line_file("/sys/class/tty/console/active", &active) >= 0) {
const char *tty;
- t
runcate_nl(active
);
- if (
(tty = strrchr(active, ' '))
)
+ t
ty = strrchr(active, ' '
);
+ if (
tty
)
tty ++;
else
tty = active;
tty ++;
else
tty = active;
@@
-103,8
+111,8
@@
int main(int argc, char *argv[]) {
log_debug("Automatically adding serial getty for /dev/%s.", tty);
log_debug("Automatically adding serial getty for /dev/%s.", tty);
- if (!(n = unit_name_replace_instance("serial-getty@.service", tty)) ||
-
add_symlink("serial-getty@.service", n) < 0)
+ n = unit_name_replace_instance("serial-getty@.service", tty);
+
if (!n ||
add_symlink("serial-getty@.service", n) < 0)
r = EXIT_FAILURE;
free(n);
r = EXIT_FAILURE;
free(n);
@@
-116,10
+124,18
@@
int main(int argc, char *argv[]) {
/* Automatically add in a serial getty on the first
* virtualizer console */
if (access("/sys/class/tty/hvc0", F_OK) == 0) {
/* Automatically add in a serial getty on the first
* virtualizer console */
if (access("/sys/class/tty/hvc0", F_OK) == 0) {
- log_debug("Automatic adding serial getty for hvc0.");
+ log_debug("Automatic
ally
adding serial getty for hvc0.");
if (add_symlink("serial-getty@.service", "serial-getty@hvc0.service") < 0)
r = EXIT_FAILURE;
if (add_symlink("serial-getty@.service", "serial-getty@hvc0.service") < 0)
r = EXIT_FAILURE;
+
+ }
+
+ if (access("/sys/class/tty/xvc0", F_OK) == 0) {
+ log_debug("Automatically adding serial getty for xvc0.");
+
+ if (add_symlink("serial-getty@.service", "serial-getty@xvc0.service") < 0)
+ r = EXIT_FAILURE;
}
finish:
}
finish: