[systemd-devel] [PATCH 1/5] Factorize some machine-id-setup functions to be reused
Didier Roche
didrocks at ubuntu.com
Tue Dec 2 02:43:16 PST 2014
Le 01/12/2014 18:38, Lennart Poettering a écrit :
> On Mon, 24.11.14 12:35, Didier Roche (didrocks at ubuntu.com) wrote:
>
>>
>> +static int get_valid_machine_id(int fd, char id[34]) {
>> + assert(fd >= 0);
>> + assert(id);
>> +
>> + if (loop_read(fd, id, 33, false) == 33 && id[32] == '\n') {
>> + id[32] = 0;
>> +
>> + if (id128_is_valid(id)) {
>> + id[32] = '\n';
>> + id[33] = 0;
>> + return 0;
>> + }
>> + }
>> +
>> + return -EINVAL;
>> +}
> As a matter of coding style we try hard to avoid functions that clobber
> their parameters if they fail. Please follow the same scheme here.
That makes sense, I rewrote the function to avoid this.
Didier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Factorize-some-machine-id-setup-functions-to-be-reus.patch
Type: text/x-diff
Size: 2567 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141202/77a17e8e/attachment-0001.patch>
More information about the systemd-devel
mailing list