[systemd-commits] 5 commits - TODO src/tmpfiles src/vconsole
Lennart Poettering
lennart at kemper.freedesktop.org
Thu Apr 9 04:13:33 PDT 2015
TODO | 2 +
src/tmpfiles/tmpfiles.c | 12 ++++----
src/vconsole/vconsole-setup.c | 61 +++++++++++++++++++++++-------------------
3 files changed, 43 insertions(+), 32 deletions(-)
New commits:
commit ab51b943d42eb6a5e4c6e26cd3c641d4e604bd1c
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 9 13:12:55 2015 +0200
vconsole: some modernizations, indentation fixes
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 5c95e3f..243e51d 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -185,11 +185,13 @@ static void font_copy_to_all_vcs(int fd) {
/* get active, and 16 bit mask of used VT numbers */
r = ioctl(fd, VT_GETSTATE, &vcs);
- if (r < 0)
+ if (r < 0) {
+ log_debug_errno(errno, "VT_GETSTATE failed, ignoring: %m");
return;
+ }
for (i = 1; i <= 15; i++) {
- char vcname[16];
+ char vcname[strlen("/dev/vcs") + DECIMAL_STR_MAX(int)];
_cleanup_close_ int vcfd = -1;
struct console_font_op cfo = {};
@@ -213,11 +215,11 @@ static void font_copy_to_all_vcs(int fd) {
/* copy map of 8bit chars */
if (ioctl(fd, GIO_SCRNMAP, map8) >= 0)
- (void) ioctl(vcfd, PIO_SCRNMAP, map8);
+ (void) ioctl(vcfd, PIO_SCRNMAP, map8);
/* copy map of 8bit chars -> 16bit Unicode values */
if (ioctl(fd, GIO_UNISCRNMAP, map16) >= 0)
- (void) ioctl(vcfd, PIO_UNISCRNMAP, map16);
+ (void) ioctl(vcfd, PIO_UNISCRNMAP, map16);
/* copy unicode translation table */
/* unimapd is a ushort count and a pointer to an
@@ -239,8 +241,7 @@ int main(int argc, char **argv) {
*vc_keymap = NULL, *vc_keymap_toggle = NULL,
*vc_font = NULL, *vc_font_map = NULL, *vc_font_unimap = NULL;
_cleanup_close_ int fd = -1;
- bool utf8;
- bool font_copy = false, font_ok, keyboard_ok;
+ bool utf8, font_copy = false, font_ok, keyboard_ok;
int r = EXIT_FAILURE;
log_set_target(LOG_TARGET_AUTO);
@@ -295,16 +296,16 @@ int main(int argc, char **argv) {
}
if (utf8)
- enable_utf8(fd);
+ (void) enable_utf8(fd);
else
- disable_utf8(fd);
+ (void) disable_utf8(fd);
font_ok = font_load_and_wait(vc, vc_font, vc_font_map, vc_font_unimap) > 0;
keyboard_ok = keyboard_load_and_wait(vc, vc_keymap, vc_keymap_toggle, utf8) > 0;
/* Only copy the font when we executed setfont successfully */
if (font_copy && font_ok)
- font_copy_to_all_vcs(fd);
+ (void) font_copy_to_all_vcs(fd);
return font_ok && keyboard_ok ? EXIT_SUCCESS : EXIT_FAILURE;
}
commit 71044f609b829d802e0eb81270e13b4f55d76476
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 9 13:12:26 2015 +0200
tmpfiles: properly return error code from path_set_acl()
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index f207f8d..d34de70 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -734,10 +734,10 @@ static int path_set_acl(const char *path, acl_type_t type, acl_t acl, bool modif
r = acl_set_file(path, type, dup);
if (r < 0)
- return -log_error_errno(errno,
- "Setting %s ACL \"%s\" on %s failed: %m",
- type == ACL_TYPE_ACCESS ? "access" : "default",
- strna(t), path);
+ return log_error_errno(errno,
+ "Setting %s ACL \"%s\" on %s failed: %m",
+ type == ACL_TYPE_ACCESS ? "access" : "default",
+ strna(t), path);
return 0;
}
commit 34f645360325c4a986f85eaea7655b986d754251
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 9 13:12:06 2015 +0200
tmpfiles: add file attribute calls to list of glob needing commands
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index decc0a8..f207f8d 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -160,7 +160,9 @@ static bool needs_glob(ItemType t) {
SET_XATTR,
RECURSIVE_SET_XATTR,
SET_ACL,
- RECURSIVE_SET_ACL);
+ RECURSIVE_SET_ACL,
+ SET_ATTRIBUTE,
+ RECURSIVE_SET_ATTRIBUTE);
}
static bool takes_ownership(ItemType t) {
commit 8aa203819fc7f2a840191f8d9d0e65566c0ce98e
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 9 13:11:38 2015 +0200
update TODO
diff --git a/TODO b/TODO
index c787b54..7be62c9 100644
--- a/TODO
+++ b/TODO
@@ -45,6 +45,8 @@ Before 220:
Features:
+* fstab-generator: default to tmpfs-as-root if only usr= is specified on the kernel cmdline
+
* check for the various fs-specific ioctls we call that we do so only
after verifying they are regular files or directories, and not
device files, so that we don't confuse drivers.
commit aecb6fcb03c56d6469815c3965a895dd46dc5c16
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 9 13:10:11 2015 +0200
vconsole: stick to kernel-style function error handling
This undoes part of 8931278c8a9ef7b60f6b6963486a9e9febb20a0d.
We really should stick to kernel-style "int" return values from
functions, and not covnert success into boolean returns.
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index fe8573f..5c95e3f 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -96,14 +96,14 @@ static int enable_utf8(int fd) {
return r;
}
-static bool keyboard_load_and_wait(const char *vc, const char *map, const char *map_toggle, bool utf8) {
+static int keyboard_load_and_wait(const char *vc, const char *map, const char *map_toggle, bool utf8) {
const char *args[8];
- int i = 0;
+ int i = 0, r;
pid_t pid;
/* An empty map means kernel map */
if (isempty(map))
- return true;
+ return 1;
args[i++] = KBD_LOADKEYS;
args[i++] = "-q";
@@ -117,25 +117,28 @@ static bool keyboard_load_and_wait(const char *vc, const char *map, const char *
args[i++] = NULL;
pid = fork();
- if (pid < 0) {
- log_error_errno(errno, "Failed to fork: %m");
- return false;
- } else if (pid == 0) {
+ if (pid < 0)
+ return log_error_errno(errno, "Failed to fork: %m");
+ else if (pid == 0) {
execv(args[0], (char **) args);
_exit(EXIT_FAILURE);
}
- return wait_for_terminate_and_warn(KBD_LOADKEYS, pid, true) == 0;
+ r = wait_for_terminate_and_warn(KBD_LOADKEYS, pid, true);
+ if (r < 0)
+ return r;
+
+ return r == 0;
}
-static bool font_load_and_wait(const char *vc, const char *font, const char *map, const char *unimap) {
+static int font_load_and_wait(const char *vc, const char *font, const char *map, const char *unimap) {
const char *args[9];
- int i = 0;
+ int i = 0, r;
pid_t pid;
/* An empty font means kernel font */
if (isempty(font))
- return true;
+ return 1;
args[i++] = KBD_SETFONT;
args[i++] = "-C";
@@ -152,15 +155,18 @@ static bool font_load_and_wait(const char *vc, const char *font, const char *map
args[i++] = NULL;
pid = fork();
- if (pid < 0) {
- log_error_errno(errno, "Failed to fork: %m");
- return false;
- } else if (pid == 0) {
+ if (pid < 0)
+ return log_error_errno(errno, "Failed to fork: %m");
+ else if (pid == 0) {
execv(args[0], (char **) args);
_exit(EXIT_FAILURE);
}
- return wait_for_terminate_and_warn(KBD_SETFONT, pid, true) == 0;
+ r = wait_for_terminate_and_warn(KBD_SETFONT, pid, true);
+ if (r < 0)
+ return r;
+
+ return r == 0;
}
/*
@@ -293,8 +299,8 @@ int main(int argc, char **argv) {
else
disable_utf8(fd);
- font_ok = font_load_and_wait(vc, vc_font, vc_font_map, vc_font_unimap);
- keyboard_ok = keyboard_load_and_wait(vc, vc_keymap, vc_keymap_toggle, utf8);
+ font_ok = font_load_and_wait(vc, vc_font, vc_font_map, vc_font_unimap) > 0;
+ keyboard_ok = keyboard_load_and_wait(vc, vc_keymap, vc_keymap_toggle, utf8) > 0;
/* Only copy the font when we executed setfont successfully */
if (font_copy && font_ok)
More information about the systemd-commits
mailing list