[systemd-devel] [PATCH 1/3] Add more password agent information
David Härdeman
david at hardeman.nu
Mon Mar 24 18:13:51 PDT 2014
On Tue, Mar 25, 2014 at 01:03:48AM +0100, Lennart Poettering wrote:
>On Wed, 12.02.14 23:55, David Härdeman (david at hardeman.nu) wrote:
>> - r = ask_password_auto(text, "drive-harddisk", until, accept_cached, passwords);
>> + if (asprintf(&id, "cryptsetup:%s", name) < 0)
>> + return log_oom();
>> +
>> + r = ask_password_auto(text, "drive-harddisk", id, until,
>> accept_cached, passwords);
>
>Hmm, no tabs please...
I've told vim to respect your indentation :)
>Also, please use strappend() for cases like this, where we just want to
>concatenate two strings.
Hmmm, the asprinf use there matches the style of the code of the rest of
the function....for example, with the patch applied that part reads:
if (asprintf(&text, "Please enter passphrase for disk %s!", name) < 0)
return log_oom();
if (asprintf(&id, "cryptsetup:%s", name) < 0)
return log_oom();
Changing the second asprintf to use strappend and cescape wouldn't
really make it more readable, would it?
>
>> if (r < 0) {
>> log_error("Failed to query password: %s", strerror(-r));
>> return r;
>> @@ -281,7 +285,10 @@ static int get_password(const char *name, usec_t until, bool accept_cached, char
>> if (asprintf(&text, "Please enter passphrase for disk %s! (verification)", name) < 0)
>> return log_oom();
>>
>> - r = ask_password_auto(text, "drive-harddisk", until, false, &passwords2);
>> + if (asprintf(&id, "cryptsetup-verification:%s", name) < 0)
>> + return log_oom();
>> +
>
>Similar here.
Ibid
--
David Härdeman
More information about the systemd-devel
mailing list