RE: [PATCH 1/2] Ignore trailing slash in mkdir() on platforms that can't deal with this

2012-08-24 Thread Joachim Schmitz
> From: Junio C Hamano [mailto:gits...@pobox.com]
> Sent: Friday, August 24, 2012 7:44 PM
> To: Joachim Schmitz
> Cc: git@vger.kernel.org
> Subject: Re: [PATCH 1/2] Ignore trailing slash in mkdir() on platforms that 
> can't deal with this
> 
> As the compat/mkdir.c file includes git-compat-util.h and expects
> the declaration of the new function to be found in it, it does not
> make any sense to have this as two patches.  I'll squash them into
> one for now, but it would have been even more complete to have an
> update to the Makefile to actually compile these files in the same
> change.  These things go together.

A changed Makefile is in the pipeline, but right now it is pretty NonStop 
specific, 
while I tried to keep compat/itimer.cm compat/mkdir.c and git-compat-util.h 
as NonStop independent as I possible could.
That Makefile also depends on the outcome of the discussion about my 
NonStop specific changed in git-compat.util.h
 
> The other itimer set shares the same issue.  I've queued mkdir and
> itimer series as one patch each; please check the result in 'pu'
> after I push it out.
 
Thanks. What does 'pu' stand for?

Bye, Jojo

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] Ignore trailing slash in mkdir() on platforms that can't deal with this

2012-08-24 Thread Junio C Hamano
As the compat/mkdir.c file includes git-compat-util.h and expects
the declaration of the new function to be found in it, it does not
make any sense to have this as two patches.  I'll squash them into
one for now, but it would have been even more complete to have an
update to the Makefile to actually compile these files in the same
change.  These things go together.

The other itimer set shares the same issue.  I've queued mkdir and
itimer series as one patch each; please check the result in 'pu'
after I push it out.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] Ignore trailing slash in mkdir() on platforms that can't deal with this

2012-08-24 Thread Joachim Schmitz

Signed-off-by: Joachim Schmitz 
---
 compat/mkdir.c | 24 
 1 file changed, 24 insertions(+)
 create mode 100644 compat/mkdir.c

diff --git a/compat/mkdir.c b/compat/mkdir.c
new file mode 100644
index 000..9e253fb
--- /dev/null
+++ b/compat/mkdir.c
@@ -0,0 +1,24 @@
+#include "../git-compat-util.h"
+#undef mkdir
+
+/* for platforms that can't deal with a trailing '/' */
+int compat_mkdir_wo_trailing_slash(const char *dir, mode_t mode)
+{
+   int retval;
+   char *tmp_dir = NULL;
+   size_t len = strlen(dir);
+
+   if (len && dir[len-1] == '/') {
+   if ((tmp_dir = strdup(dir)) == NULL)
+   return -1;
+   tmp_dir[len-1] = '\0';
+   }
+   else
+   tmp_dir = (char *)dir;
+
+   retval = mkdir(tmp_dir, mode);
+   if (tmp_dir != dir)
+   free(tmp_dir);
+
+   return retval;
+}
-- 
1.7.12


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html