Please send my copies of relevant replies. Attached a patch that adds reporting of certain error condition. Can applied to the cvs version (might need -F 3). Bernhard -- Professional Service around Free Software (intevation.net) The FreeGIS Project (freegis.org) Association for a Free Informational Infrastructure (ffii.org) FSF Europe (fsfeurope.org)
Makes mgp stop and report the problem if the system() calls
for image conversion fail.
<bernhard@intevation.de>
--- magicpoint-1.08a/mgp.c.1 Mon Dec 31 00:56:08 2001
+++ magicpoint-1.08a/mgp.c Mon Dec 31 01:16:47 2001
@@ -439,6 +439,7 @@
FILE *html;
FILE *txt;
int page;
+ int result=0;
char *childdebug;
char *(convdb[][3]) = {{ "jpg", "cjpeg", "djpeg" },
{ "png", "pnmtopng", "pngtopnm" },
@@ -496,13 +497,23 @@
sprintf(buf, "xwintoppm -silent -name MagicPoint | "
"%s %s > %s/mgp%05d.%s",
convdb[inum][1], childdebug, dumpdir, page, EXT);
- system(buf); /*XXX security hole*/
+ result=system(buf); /*XXX security hole*/
+ if(result) {
+ fprintf(stderr, "running: \"%s\" failed code=%d\n",
+ buf,result);
+ cleanup(-1);
+ }
fprintf(stderr, "(thumbnail)");
sprintf(buf, "%s %s/mgp%05d.%s | "
"pnmscale 0.25 | %s %s > %s/mgp%05d.idx.%s",
convdb[inum][2], dumpdir, page, EXT, convdb[inum][1], childdebug,
dumpdir, page, EXT);
- system(buf); /*XXX security hole*/
+ result=system(buf); /*XXX security hole*/
+ if(result) {
+ fprintf(stderr, "running: \"%s\" failed code=%d\n",
+ buf,result);
+ cleanup(-1);
+ }
/*
* dump out html file
Attachment:
pgpyingpOeL3_.pgp
Description: PGP signature