From 30c091ca8d95e75049fefb2f8ae1b74ccf0d2488 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Tue, 10 Jul 2007 18:06:30 -0400 Subject: [PATCH] Return -1 if the file is cached but there was an error or -2 if the file was cached and successful with pwmd_open_nb() and pwmd_save_nb(). --- libpwmd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libpwmd.c b/libpwmd.c index 36cd4fb6..803288e7 100644 --- a/libpwmd.c +++ b/libpwmd.c @@ -731,14 +731,14 @@ gotpassword: xfree(pwm->filename); pwm->filename = xstrdup(filename); - - /* - * The file is cached or the file is a new file. - */ - if (nb) - return -2; } + /* + * The file is cached or the file is a new file. + */ + if (nb) + return *error ? -1 : -2; + return *error ? PWMD_ERROR : PWMD_OK; } @@ -927,6 +927,10 @@ static int do_pwmd_save(pwm_t *pwm, gpg_error_t *error, int nb) password = pwm->password; *error = do_save_command(pwm, password); + + if (nb) + return *error ? -1 : -2; + return *error ? PWMD_ERROR : PWMD_OK; } -- 2.11.4.GIT