On Fri, 12.07.13 20:48, Jan Janssen ([email protected]) wrote:

> 
> On 07/12/2013 08:36 PM, Lennart Poettering wrote:
> >On Tue, 09.07.13 21:15, Jan Janssen ([email protected]) wrote:
> >
> >>+        if (*key_file) {
> >>+                r = read_one_line_file(*key_file, &passphrase);
> >>+                if (r < 0) {
> >>+                        log_error("Failed to read key file: %s", 
> >>strerror(-r));
> >>+                        *key_file = NULL;
> >>+                        return -EAGAIN;
> >
> >I can't say I like functions that change the parameters when they fail,
> >any chance we can fix that?
> >
> >otherwise looks good.
> >
> >Lennart
> >
> 
> When I read the (old) luks code correctly, it does the same: falling
> back to normal password query if the key file does not work. I just
> thought it would be best to do the same here.

I am all for falling back to normal password query if the file does not
exist, however, I don't like the programming style where you alter
pass-by-reference parameters of function when failing.

Changing pass-by-ref parameters on success is a good way to return data,
but I think it is generally a bad idea to alter pass-by-ref params if
you fail. 

So, this is not a question of general behaviour of the tool, but only of
the coding style. 

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to