Update of /cvsroot/tmda/tmda/contrib/cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv4236

Modified Files:
        tmda-cgi.c 
Log Message:
Added some error checking in case the chdir fails.


Index: tmda-cgi.c
===================================================================
RCS file: /cvsroot/tmda/tmda/contrib/cgi/tmda-cgi.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- tmda-cgi.c  5 Dec 2002 18:29:21 -0000       1.3
+++ tmda-cgi.c  14 Dec 2002 01:41:32 -0000      1.4
@@ -20,6 +20,7 @@
 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
 
 #include <stdlib.h>
+
 #include "dirs.h"
 
 int main(int argc, char *argv[])
@@ -29,8 +30,11 @@
 #endif
   setenv("TMDA_CGI_MODE", MODE, 1);
 
-  chdir(INSTALL);
-  execl(PYTHON, PYTHON, "tmda-cgi.py", 0);
-
-  return 0;
+  if (!chdir(INSTALL))
+  {
+    execl(PYTHON, PYTHON, "tmda-cgi.py", 0);
+    return 0;
+  }
+  printf("Content-type: text/html\n\nCannot change to directory: %s", INSTALL);
+  return 1;
 }

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs

Reply via email to