Code

gitweb: Add "next" link to commitdiff view
[git.git] / imap-send.c
index 6a52dbdca4f61cc1bfc288e7766e87a1425e9b3c..16804ab286a42c0dc2733dccf816ab2173e465af 100644 (file)
@@ -1007,7 +1007,7 @@ imap_open_store( imap_server_conf_t *srvc )
                         * getpass() returns a pointer to a static buffer.  make a copy
                         * for long term storage.
                         */
-                       srvc->pass = strdup( arg );
+                       srvc->pass = xstrdup( arg );
                }
                if (CAP(NOLOGIN)) {
                        fprintf( stderr, "Skipping account %s@%s, server forbids LOGIN\n", srvc->user, srvc->host );
@@ -1226,6 +1226,14 @@ split_msg( msg_data_t *all_msgs, msg_data_t *msg, int *ofs )
        if (msg->len < 5 || strncmp( data, "From ", 5 ))
                return 0;
 
+       p = strchr( data, '\n' );
+       if (p) {
+               p = &p[1];
+               msg->len -= p-data;
+               *ofs += p-data;
+               data = p;
+       }
+
        p = strstr( data, "\nFrom " );
        if (p)
                msg->len = &p[1] - data;
@@ -1263,7 +1271,7 @@ git_imap_config(const char *key, const char *val)
        key += sizeof imap_key - 1;
 
        if (!strcmp( "folder", key )) {
-               imap_folder = strdup( val );
+               imap_folder = xstrdup( val );
        } else if (!strcmp( "host", key )) {
                {
                        if (!strncmp( "imap:", val, 5 ))
@@ -1273,16 +1281,16 @@ git_imap_config(const char *key, const char *val)
                }
                if (!strncmp( "//", val, 2 ))
                        val += 2;
-               server.host = strdup( val );
+               server.host = xstrdup( val );
        }
        else if (!strcmp( "user", key ))
-               server.user = strdup( val );
+               server.user = xstrdup( val );
        else if (!strcmp( "pass", key ))
-               server.pass = strdup( val );
+               server.pass = xstrdup( val );
        else if (!strcmp( "port", key ))
                server.port = git_config_int( key, val );
        else if (!strcmp( "tunnel", key ))
-               server.tunnel = strdup( val );
+               server.tunnel = xstrdup( val );
        return 0;
 }