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

Didier Roche didrocks at ubuntu.com
Tue Mar 10 09:56:38 PDT 2015


Le 10/03/2015 11:36, Lennart Poettering a écrit :
> On Tue, 10.03.15 11:32, Didier Roche (didrocks at ubuntu.com) wrote:
>
>>   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;
>>           int r;
>>   
>>           r = manager_connect_plymouth(m);
>> @@ -258,7 +258,7 @@ 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"));
>> +                plymouth_cancel_message = strjoin("fsckd-cancel-msg:", _("Press Ctrl+C to cancel all filesystem checks in progress"), NULL);
>>   
> Well, there's an OOM check missing now, as strjoin() can fail...
>
> That said, I think using strjoina is actually a good idea here, the
> string is not unbounded. Hence I think it would be a good idea to
> first assign the result of _() to a const char* variable in one step,
> and then concat it in a second...

Makes sense. Here is the suggested change.

Didier

PS: just posting a couple of patches from your suggestion, I'll work on 
the bigger discussion of passing the fsck pipe to systemd-fsckd later in 
the week.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fsckd-Don-t-use-strjoina-on-gettext-call.patch
Type: text/x-diff
Size: 1438 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150310/a30509c1/attachment.patch>


More information about the systemd-devel mailing list