[cairo-commit] libsvg/src svg.c,1.10,1.11

Carl Worth commit at pdx.freedesktop.org
Mon Feb 28 15:32:01 PST 2005


Committed by: cworth

Update of /cvs/cairo/libsvg/src
In directory gabe:/tmp/cvs-serv18463/src

Modified Files:
	svg.c 
Log Message:

        * src/svg.c (svg_render): Use getcwd in accordance with POSIX
        rather than relying on a Linux-specific extension to its
        behavior. Based on a patch by Brian Cameron, (thanks for helping
        us track this down, Brian).


Index: svg.c
===================================================================
RCS file: /cvs/cairo/libsvg/src/svg.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- svg.c	14 Feb 2005 17:26:26 -0000	1.10
+++ svg.c	28 Feb 2005 23:31:59 -0000	1.11
@@ -26,6 +26,7 @@
 #include <unistd.h>
 #include <libgen.h>
 #include <zlib.h>
+#include <sys/param.h>
 
 #include "svgint.h"
 
@@ -205,7 +206,7 @@
 	    void		*closure)
 {
     svg_status_t status;
-    char *orig_dir;
+    char orig_dir[MAXPATHLEN];
 
     if (svg->group_element == NULL)
 	return SVG_STATUS_SUCCESS;
@@ -215,16 +216,12 @@
        directory -- at least I'll be nice about it and restore it
        afterwards. */
 
-    /* XXX: non-Posix, Linux-extension getcwd usage. */
-    orig_dir = getcwd (NULL, 0);
-    if (orig_dir == NULL)
-	return SVG_STATUS_NO_MEMORY;
+    getcwd (orig_dir, MAXPATHLEN);
     chdir (svg->dir_name);
     
     status = svg_element_render (svg->group_element, engine, closure);
 
     chdir (orig_dir);
-    free (orig_dir);
 
     return status;
 }




More information about the cairo-commit mailing list