]> diplodocus.org Git - nmh/blobdiff - uip/mhlogin.c
lock_file.c: close(2) file descriptor on failure, avoiding leak.
[nmh] / uip / mhlogin.c
index 32183863c1f403a080e0f4c3ca59686a5a56b419..e78ae68f263991a9d7faff77ac52be5ef33df461 100644 (file)
@@ -12,6 +12,7 @@
 #include <h/mh.h>
 #include <h/utils.h>
 #include <h/oauth.h>
 #include <h/mh.h>
 #include <h/utils.h>
 #include <h/oauth.h>
+#include "sbr/lock_file.h"
 
 #define MHLOGIN_SWITCHES \
     X("user username", 0, USERSW) \
 
 #define MHLOGIN_SWITCHES \
     X("user username", 0, USERSW) \
@@ -63,7 +64,7 @@ do_login(const char *svc, const char *user, const char *browser, int snoop)
     }
 
     if (!mh_oauth_new(&ctx, svc)) {
     }
 
     if (!mh_oauth_new(&ctx, svc)) {
-        adios(NULL, mh_oauth_get_err_string(ctx));
+        adios(NULL, "%s", mh_oauth_get_err_string(ctx));
     }
 
     if (snoop) {
     }
 
     if (snoop) {
@@ -73,7 +74,7 @@ do_login(const char *svc, const char *user, const char *browser, int snoop)
     fn = mh_xstrdup(mh_oauth_cred_fn(svc));
 
     if ((url = mh_oauth_get_authorize_url(ctx)) == NULL) {
     fn = mh_xstrdup(mh_oauth_cred_fn(svc));
 
     if ((url = mh_oauth_get_authorize_url(ctx)) == NULL) {
-      adios(NULL, mh_oauth_get_err_string(ctx));
+      adios(NULL, "%s", mh_oauth_get_err_string(ctx));
     }
 
     if (browser) {
     }
 
     if (browser) {
@@ -109,7 +110,7 @@ do_login(const char *svc, const char *user, const char *browser, int snoop)
     }
     if (cred == NULL) {
       inform("error exchanging code for OAuth2 token");
     }
     if (cred == NULL) {
       inform("error exchanging code for OAuth2 token");
-      adios(NULL, mh_oauth_get_err_string(ctx));
+      adios(NULL, "%s", mh_oauth_get_err_string(ctx));
     }
 
     cred_file = lkfopendata(fn, "r+", &failed_to_lock);
     }
 
     cred_file = lkfopendata(fn, "r+", &failed_to_lock);
@@ -120,7 +121,7 @@ do_login(const char *svc, const char *user, const char *browser, int snoop)
       adios(fn, "oops");
     }
     if (!mh_oauth_cred_save(cred_file, cred, user)) {
       adios(fn, "oops");
     }
     if (!mh_oauth_cred_save(cred_file, cred, user)) {
-      adios(NULL, mh_oauth_get_err_string(ctx));
+      adios(NULL, "%s", mh_oauth_get_err_string(ctx));
     }
     if (lkfclosedata(cred_file, fn) != 0) {
       adios (fn, "oops");
     }
     if (lkfclosedata(cred_file, fn) != 0) {
       adios (fn, "oops");