[grisbi-cvs] grisbi/src gsb_file_save.c,1.137,1.138

Mickaƫl Remars mykeul at users.sourceforge.net
Mon Aug 24 21:30:06 CEST 2009


Update of /cvsroot/grisbi/grisbi/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28029

Modified Files:
	gsb_file_save.c 
Log Message:
uses _chmod() instead of chmod() when compiling on msvc

Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -r1.137 -r1.138
--- gsb_file_save.c	16 Aug 2009 21:00:05 -0000	1.137
+++ gsb_file_save.c	24 Aug 2009 19:30:04 -0000	1.138
@@ -26,6 +26,9 @@
  */
 
 #include "include.h"
+#ifdef _MSC_VER
+#	include <io.h> // for _chmod()
+#endif//_MSC_VER
 #include <zlib.h>
 
 /*START_INCLUDE*/
@@ -439,18 +442,32 @@
 
     /* if it's a new file, we set the permission */
     if ( do_chmod )
+	{
 	/* it's a new file or stat couldn't find the permissions,
 	 * so set only user can see the file by default */
-	chmod ( filename,
-		S_IRUSR | S_IWUSR );
+#ifdef _MSC_VER
+	_chmod ( filename, _S_IREAD | _S_IWRITE );
+#else
+	chmod ( filename, S_IRUSR | S_IWUSR );
+#endif//_MSC_VER
+	}
     else
     {
 	/* it's not a new file but gtk overwrite the permissions
 	 * so need to re-set the good permissions saved before */
+#ifdef _MSC_VER
+	if (_chmod (filename, buf.st_mode) == -1)
+	{
+	    /* we couldn't set the chmod, set the default permission */
+		_chmod ( filename, _S_IREAD | _S_IWRITE );
+	}
+#else
 	if (chmod (filename, buf.st_mode) == -1)
+	{
 	    /* we couldn't set the chmod, set the default permission */
-	    chmod ( filename,
-		    S_IRUSR | S_IWUSR );
+		chmod ( filename, S_IRUSR | S_IWUSR );
+	}
+#endif//_MSC_VER
     }
 
     etat.en_train_de_sauvegarder = 0;



More information about the cvs mailing list