diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-04-30 16:57:31 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-04-30 16:57:31 +0200 |
commit | 908dceb882723460cde35ec8ef22927b702ab874 (patch) | |
tree | 0598a9cb5d720c66c619fd350d64453490b35143 /src/utils | |
parent | 8a67e721880959b431d220e2d1fd5b60a4f11ad7 (diff) | |
parent | 0b1c6eb3c4941dc2d47ad3207bab4509ae1014cc (diff) | |
download | mana-908dceb882723460cde35ec8ef22927b702ab874.tar.gz mana-908dceb882723460cde35ec8ef22927b702ab874.tar.bz2 mana-908dceb882723460cde35ec8ef22927b702ab874.tar.xz mana-908dceb882723460cde35ec8ef22927b702ab874.zip |
Merge branch '0.5'
Conflicts:
CMakeLists.txt
po/fi.po
po/fr.po
src/gui/skilldialog.cpp
src/localplayer.cpp
src/net/manaserv/generalhandler.cpp
src/net/tmwa/buysellhandler.cpp
src/net/tmwa/generalhandler.cpp
src/net/tmwa/playerhandler.cpp
src/net/tmwa/specialhandler.cpp
src/winver.h
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/mkdir.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/utils/mkdir.cpp b/src/utils/mkdir.cpp index 549e77a2..75ab8595 100644 --- a/src/utils/mkdir.cpp +++ b/src/utils/mkdir.cpp @@ -36,17 +36,13 @@ #include "mkdir.h" +/// Create a directory, making leading components first if necessary int mkdir_r(const char *pathname) { - char tmp[PATH_MAX]; + size_t len = strlen(pathname); + char tmp[len+2]; char *p; - if (strlen(pathname) >= PATH_MAX-2) - return -1; - - strncpy(tmp, pathname, sizeof(tmp)-1); - tmp[PATH_MAX-1] = '\0'; - - int len=strlen(tmp); + strcpy(tmp, pathname); // terminate the pathname with '/' if (tmp[len-1] != '/') { |