Ignore trailing slash in mkdir() on platforms that can't deal with this
PATCH 1/2 Ignore trailing slash in mkdir() on platforms that can't deal with this
--- compat/mkdir.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 compat/mkdir.c
compat/mkdir.c new file +24 -0
@@ -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; +}
Signature · 1 line
1.7.12
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.
Quoted 6 lines
From: Junio C Hamano [mailto:[email protected]]
Sent: Friday, August 24, 2012 7:44 PM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: [PATCH 1/2] Ignore trailing slash inmkdir()on platforms that can't deal with this
Quoted 6 lines
As the
compat/mkdir.cfile includesgit-compat-util.hand 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 theMakefileto 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
Quoted 3 lines
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