зеркало из https://github.com/microsoft/git.git
vcs-svn: Check for errors from open()
test-svn-fe segfaults when passed a bogus path. Simplify debugging by exiting with a meaningful error message instead. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
1f05d07c45
Коммит
5c28a8b054
|
@ -8,7 +8,8 @@
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
svndump_init(NULL);
|
||||
if (svndump_init(NULL))
|
||||
return 1;
|
||||
svndump_read((argc > 1) ? argv[1] : NULL);
|
||||
svndump_deinit();
|
||||
svndump_reset();
|
||||
|
|
|
@ -9,7 +9,8 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
if (argc != 2)
|
||||
usage("test-svn-fe <file>");
|
||||
svndump_init(argv[1]);
|
||||
if (svndump_init(argv[1]))
|
||||
return 1;
|
||||
svndump_read(NULL);
|
||||
svndump_deinit();
|
||||
svndump_reset();
|
||||
|
|
|
@ -290,14 +290,16 @@ void svndump_read(const char *url)
|
|||
handle_revision();
|
||||
}
|
||||
|
||||
void svndump_init(const char *filename)
|
||||
int svndump_init(const char *filename)
|
||||
{
|
||||
buffer_init(filename);
|
||||
if (buffer_init(filename))
|
||||
return error("cannot open %s: %s", filename, strerror(errno));
|
||||
repo_init();
|
||||
reset_dump_ctx(~0);
|
||||
reset_rev_ctx(0);
|
||||
reset_node_ctx(NULL);
|
||||
init_keys();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void svndump_deinit(void)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef SVNDUMP_H_
|
||||
#define SVNDUMP_H_
|
||||
|
||||
void svndump_init(const char *filename);
|
||||
int svndump_init(const char *filename);
|
||||
void svndump_read(const char *url);
|
||||
void svndump_deinit(void);
|
||||
void svndump_reset(void);
|
||||
|
|
Загрузка…
Ссылка в новой задаче