contrib/git-credential-gnome-keyring.c: set Gnome application name
[gitweb.git] / contrib / credential / gnome-keyring / git-credential-gnome-keyring.c
index 04852d77d3a1c5363daf0d01460abe43a6edbed3..43b19dd5a21721b1232b7c7570fdd314480bca3d 100644 (file)
@@ -28,6 +28,7 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <glib.h>
 #include <gnome-keyring.h>
 
 /*
@@ -306,7 +307,7 @@ static void credential_clear(struct credential *c)
 static int credential_read(struct credential *c)
 {
        char    buf[1024];
-       ssize_t line_len = 0;
+       size_t line_len;
        char   *key      = buf;
        char   *value;
 
@@ -314,7 +315,7 @@ static int credential_read(struct credential *c)
        {
                line_len = strlen(buf);
 
-               if (buf[line_len-1]=='\n')
+               if (line_len && buf[line_len-1] == '\n')
                        buf[--line_len]='\0';
 
                if (!line_len)
@@ -399,6 +400,8 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
 
+       g_set_application_name("Git Credential Helper");
+
        /* lookup operation callback */
        while (try_op->name && strcmp(argv[1], try_op->name))
                try_op++;