Author: manolo
Date: 2010-12-02 14:07:29 -0800 (Thu, 02 Dec 2010)
New Revision: 7941
Log:
Fix for STR #2465: make sure that system preference files are user readable 
(unix).

Modified:
   branches/branch-1.3/src/Fl_Preferences.cxx

Modified: branches/branch-1.3/src/Fl_Preferences.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Preferences.cxx  2010-12-02 17:58:58 UTC (rev 
7940)
+++ branches/branch-1.3/src/Fl_Preferences.cxx  2010-12-02 22:07:29 UTC (rev 
7941)
@@ -1321,6 +1321,21 @@
   fprintf( f, "; application: %s\n", application_ );
   prefs_->node->write( f );
   fclose( f );
+#if !(defined(__APPLE__) || defined(WIN32))
+  // unix: make sure that system prefs are user-readable
+  if (strncmp(filename_, "/etc/fltk/", 10) == 0) {
+    char *p;
+    p = filename_ + 9;
+    do { // for each directory to the pref file
+      *p = 0;
+      fl_chmod(filename_, 0755); // rwxr-xr-x
+      *p = '/';
+      p = strchr(p+1, '/');
+      }
+    while (p);
+    fl_chmod(filename_, 0644); // rw-r--r--
+    }
+#endif
   return 0;
 }
 

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to