librep r2915 - in trunk: . src



Author: chrisb
Date: Tue Aug  5 19:53:58 2008
New Revision: 2915
URL: http://svn.gnome.org/viewvc/librep?rev=2915&view=rev

Log:
Trim trailing '/' to mkdir(2) since some OSes fail the call otherwise (NetBSD patch)


Modified:
   trunk/ChangeLog
   trunk/src/unix_files.c

Modified: trunk/src/unix_files.c
==============================================================================
--- trunk/src/unix_files.c	(original)
+++ trunk/src/unix_files.c	Tue Aug  5 19:53:58 2008
@@ -303,6 +303,12 @@
 repv
 rep_make_directory(repv dir)
 {
+    int len = rep_STRING_LEN(dir);
+
+    /* Trim trailing '/' to mkdir(2) since some OSes fail the call otherwise */
+    if (*(rep_STR(dir) + len - 1) == '/')
+	dir = rep_string_dupn(rep_STR(dir), len - 1);
+
     if(mkdir(rep_STR(dir), S_IRWXU | S_IRWXG | S_IRWXO) == 0)
 	return Qt;
     else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]