[systemd-devel] [PATCH 1/5] fsckd: Don't use strjoina on gettext() call

Martin Pitt martin.pitt at ubuntu.com
Wed Mar 11 01:29:11 PDT 2015


Hello all,

Didier Roche [2015-03-10 17:56 +0100]:
> --- a/src/fsckd/fsckd.c
> +++ b/src/fsckd/fsckd.c
> @@ -272,7 +272,7 @@ static int plymouth_send_message(int plymouth_fd, const char *message, bool upda
>  }
>  
>  static int manager_send_plymouth_message(Manager *m, const char *message) {
> -        const char *plymouth_cancel_message = NULL;
> +        _cleanup_free_ const char *plymouth_cancel_message = NULL, *l10n_cancel_message = NULL;
>          int r;

As far as I can see, this would free(l10n_cancel_message) on exit, but
you must never free the result of gettext(). So split this into

  _cleanup_free_ const char *plymouth_cancel_message = NULL;
  const char *l10n_cancel_message;

?

>  
>          r = manager_connect_plymouth(m);
> @@ -288,7 +288,8 @@ static int manager_send_plymouth_message(Manager *m, const char *message) {
>  
>                  m->plymouth_cancel_sent = true;
>  
> -                plymouth_cancel_message = strjoina("fsckd-cancel-msg:", _("Press Ctrl+C to cancel all filesystem checks in progress"));
> +                l10n_cancel_message = _("Press Ctrl+C to cancel all filesystem checks in progress");
> +                plymouth_cancel_message = strjoina("fsckd-cancel-msg:", l10n_cancel_message);

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


More information about the systemd-devel mailing list