On Sun, 01.02.15 14:28, Zbigniew Jędrzejewski-Szmek
([email protected]) wrote:
>
> if (!switch_root_init) {
> - char sfd[16];
> + char sfd[DECIMAL_STR_MAX(int) + 1];
>
> /* First try to spawn ourselves with the right
> * path, and with full serialization. We do
> @@ -1893,8 +1893,7 @@ finish:
> assert(arg_serialization);
> assert(fds);
>
> - snprintf(sfd, sizeof(sfd), "%i",
> fileno(arg_serialization));
> - char_array_0(sfd);
> + xsprintf(sfd, "%i",
> - fileno(arg_serialization));
BTW, one minor comment on this: DECIMAL_STR_MAX() actually already
includes space for the trailing NUL, the +1 for sizing this array are
hence unnecesary.
I like the xsprintf() concept!
> diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
> index 74f40b9..1f85536 100644
> --- a/src/timedate/timedatectl.c
> +++ b/src/timedate/timedatectl.c
> @@ -38,6 +38,8 @@
> #include "pager.h"
> #include "time-dst.h"
>
> +#define xstrftime(buf, fmt, tm) assert_se(strftime(buf, sizeof(buf), fmt,
> tm) > 0)
> +
Maybe move this to time-util.h, even though it currently has a single
user only...
> +typedef enum {
> + CREATION_NORMAL,
> + CREATION_EXISTING,
> + CREATION_FORCE,
> +} CreationMode;
> +
> +static const char* creation_verb(CreationMode mode) {
> + switch(mode) {
> + case CREATION_NORMAL:
> + return "Created";
> + case CREATION_EXISTING:
> + return "Found existing";
> + case CREATION_FORCE:
> + return "Created replacement";
> + }
> + assert_not_reached("Bad creation");
> +}
Maybe a candidate for DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING()?
I recently split up DEFINE_PRIVATE_STRING_TABLE_LOOKUP() so that one
can also just male use of the to_string() part without the
from_string() part...
> --- a/units/[email protected]
> +++ b/units/[email protected]
> @@ -19,3 +19,4 @@ Type=oneshot
> RemainAfterExit=yes
> ExecStart=@rootlibexecdir@/systemd-backlight load %i
> ExecStop=@rootlibexecdir@/systemd-backlight save %i
> +TimeoutSec=2min
Our usual default timeout is 90s so far (see def.h), we probably
should stick to that here...
Lennart
--
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel