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:
parent
1f05d07c45
commit
5c28a8b054
@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
svndump_init(NULL);
|
if (svndump_init(NULL))
|
||||||
|
return 1;
|
||||||
svndump_read((argc > 1) ? argv[1] : NULL);
|
svndump_read((argc > 1) ? argv[1] : NULL);
|
||||||
svndump_deinit();
|
svndump_deinit();
|
||||||
svndump_reset();
|
svndump_reset();
|
||||||
|
@ -9,7 +9,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
usage("test-svn-fe <file>");
|
usage("test-svn-fe <file>");
|
||||||
svndump_init(argv[1]);
|
if (svndump_init(argv[1]))
|
||||||
|
return 1;
|
||||||
svndump_read(NULL);
|
svndump_read(NULL);
|
||||||
svndump_deinit();
|
svndump_deinit();
|
||||||
svndump_reset();
|
svndump_reset();
|
||||||
|
@ -290,14 +290,16 @@ void svndump_read(const char *url)
|
|||||||
handle_revision();
|
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();
|
repo_init();
|
||||||
reset_dump_ctx(~0);
|
reset_dump_ctx(~0);
|
||||||
reset_rev_ctx(0);
|
reset_rev_ctx(0);
|
||||||
reset_node_ctx(NULL);
|
reset_node_ctx(NULL);
|
||||||
init_keys();
|
init_keys();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void svndump_deinit(void)
|
void svndump_deinit(void)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef SVNDUMP_H_
|
#ifndef SVNDUMP_H_
|
||||||
#define 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_read(const char *url);
|
||||||
void svndump_deinit(void);
|
void svndump_deinit(void);
|
||||||
void svndump_reset(void);
|
void svndump_reset(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user