]> asedeno.scripts.mit.edu Git - git.git/blobdiff - imap-send.c
Add compat/fopen.c which returns NULL on attempt to open directory
[git.git] / imap-send.c
index 905d09746aa36f18d873605518fbeaca25d17f73..9025d9aa3ef37b1a1ce4ae5d4b447e3b0918cb7e 100644 (file)
@@ -105,6 +105,19 @@ static void free_generic_messages( message_t * );
 
 static int nfsnprintf( char *buf, int blen, const char *fmt, ... );
 
+static int nfvasprintf(char **strp, const char *fmt, va_list ap)
+{
+       int len;
+       char tmp[8192];
+
+       len = vsnprintf(tmp, sizeof(tmp), fmt, ap);
+       if (len < 0)
+               die("Fatal: Out of memory\n");
+       if (len >= sizeof(tmp))
+               die("imap command overflow !\n");
+       *strp = xmemdupz(tmp, len);
+       return len;
+}
 
 static void arc4_init( void );
 static unsigned char arc4_getbyte( void );
@@ -1167,7 +1180,7 @@ read_message( FILE *f, msg_data_t *msg )
        } while (!feof(f));
 
        msg->len  = buf.len;
-       msg->data = strbuf_detach(&buf);
+       msg->data = strbuf_detach(&buf, NULL);
        return msg->len;
 }
 
@@ -1241,6 +1254,10 @@ git_imap_config(const char *key, const char *val)
 
        if (strncmp( key, imap_key, sizeof imap_key - 1 ))
                return 0;
+
+       if (!val)
+               return config_error_nonbool(key);
+
        key += sizeof imap_key - 1;
 
        if (!strcmp( "folder", key )) {