summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjartan Maraas <kmaraas@gnome.org>2003-05-01 11:55:23 +0000
committerKjartan Maraas <kmaraas@src.gnome.org>2003-05-01 11:55:23 +0000
commitac323699ae10d9ddd8a7d11c98965738e492f27d (patch)
treec4e6a8e1e922bba5605461f3e9cac864a6d89ce8
parentf5cead9436dd042e20cce777059b03de119a35f4 (diff)
downloadyelp-ac323699ae10d9ddd8a7d11c98965738e492f27d.tar.gz
Two patches from John Fleck to fix crashes when feeding directories to the
2003-05-01 Kjartan Maraas <kmaraas@gnome.org> * help-converters/info/main.c: (file_exists): * help-converters/man/gnome-man2html.c: (main): Two patches from John Fleck to fix crashes when feeding directories to the help converters. Fixes bug #104056.
-rw-r--r--src/info2html/main.c4
-rw-r--r--src/man2html/yelp-man2html.c10
2 files changed, 14 insertions, 0 deletions
diff --git a/src/info2html/main.c b/src/info2html/main.c
index c7841f23..877bd0e9 100644
--- a/src/info2html/main.c
+++ b/src/info2html/main.c
@@ -44,6 +44,10 @@ static struct poptOption options[] = {
static int
file_exists(const char *fn)
{
+ if (g_file_test(fn, G_FILE_TEST_IS_DIR)) {
+ return FALSE;
+ }
+
struct stat sbuf;
return (stat(fn, &sbuf) == 0);
diff --git a/src/man2html/yelp-man2html.c b/src/man2html/yelp-man2html.c
index c021fa78..1e2b6162 100644
--- a/src/man2html/yelp-man2html.c
+++ b/src/man2html/yelp-man2html.c
@@ -3762,6 +3762,16 @@ main(int argc, char **argv)
infile = argv[i];
}
+ if (g_file_test(infile, G_FILE_TEST_IS_DIR)) {
+ printf("<HTML><HEAD><TITLE>Document not found</TITLE>\n"
+ "</HEAD><BODY>"
+ "I don't know how to open the document \"%s\" "
+ "on your system.\n"
+ "</BODY></HTML>\n", infile);
+
+ return 4;
+ }
+
if(!infile || !strcmp(infile, "-"))
infh = gzdopen(0, "r");
else