[systemd-devel] [PATCH 4/4] Adding unmount functions to be used in shutdown

Gustavo Sverzut Barbieri barbieri at profusion.mobi
Tue Oct 5 13:41:53 PDT 2010


On Tue, Oct 5, 2010 at 5:38 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Tue, 05.10.10 08:41, fidencio at profusion.mobi (fidencio at profusion.mobi) wrote:
>
>> +static int swap_list_get(MountPoint **swap_list_head) {
>> +        FILE *proc_swaps;
>> +
>> +        if (!(proc_swaps = fopen("/proc/swaps", "re")))
>> +                return -errno;
>> +
>> +        (void) fscanf(proc_swaps, "%*s %*s %*s %*s %*s\n");
>> +
>> +        for (;;) {
>> +                MountPoint *swap;
>> +                char *dev = NULL, *d;
>> +                int k;
>> +
>> +                if ((k = fscanf(proc_swaps,
>> +                                "%ms " /* device/file */
>> +                                "%*s " /* type of swap */
>> +                                "%*s " /* swap size */
>> +                                "%*s " /* used */
>> +                                "%*s\n", /* priority */
>> +                                &dev)) != 1) {
>> +
>> +                        if (k == EOF)
>> +                                break;
>> +
>> +                        free(dev);
>> +                        return -EBADMSG;
>
> Please just "continue" in this error case, too, much like you handle
> mountinfo.

Yes, I've asked fidencio to be more permissive with errors trying to
continue as far as possible, that also includes not return from the
shutdown program when some error occurs. Your comment goes in the same
lines :-)

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbieri at gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202


More information about the systemd-devel mailing list