Enlightenment CVS committal
Author : tsauerbeck
Project : e17
Module : libs/edje
Dir : e17/libs/edje/src/bin
Modified Files:
edje_cc.c
Log Message:
check that the input file exists. make sure that the input file doesn't equal the
output file
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- edje_cc.c 13 Oct 2004 03:43:41 -0000 1.18
+++ edje_cc.c 16 Oct 2004 11:34:09 -0000 1.19
@@ -1,3 +1,7 @@
+/*
+ * vim:ts=8:sw=3:sts=3:noexpandtab
+ */
+
#include "edje_cc.h"
static void main_help(void);
@@ -45,6 +49,8 @@
main(int argc, char **argv)
{
int i;
+ struct stat st;
+ char rpath[PATH_MAX], rpath2[PATH_MAX];
setlocale(LC_NUMERIC, "C");
@@ -128,6 +134,15 @@
main_help();
exit(-1);
}
+
+ /* check whether file_in exists */
+ if (!realpath(file_in, rpath) || stat(rpath, &st) || !S_ISREG(st.st_mode))
+ {
+ fprintf(stderr, "%s: Error: file not found: %s.\n", progname, file_in);
+ main_help();
+ exit(-1);
+ }
+
if (!file_out)
{
char *suffix;
@@ -149,6 +164,13 @@
exit(-1);
}
+ if (realpath(file_out, rpath2) && !strcmp (rpath, rpath2))
+ {
+ fprintf(stderr, "%s: Error: input file equals output file.\n", progname);
+ main_help();
+ exit(-1);
+ }
+
edje_init();
edje_file = mem_alloc(SZ(Edje_File));
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs