imap-send: properly error out if imap.host is not set in config

If no imap host is specified in the git config, git imap-send used
to try to lookup a null pointer through gethostbyname(), causing a
segfault.  Since setting the imap.host variable is mandatory,
imap-send now properly fails with an explanatory error message.

The problem has been reported by picca through
 http://bugs.debian.org/472632

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Gerrit Pape 2008-03-26 18:05:17 +00:00 коммит произвёл Junio C Hamano
Родитель 40ae8872a1
Коммит 5b67b8e2d4
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -1302,6 +1302,10 @@ main(int argc, char **argv)
fprintf( stderr, "no imap store specified\n" );
return 1;
}
if (!server.host) {
fprintf( stderr, "no imap host specified\n" );
return 1;
}
/* read the messages */
if (!read_message( stdin, &all_msgs )) {