diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-12-30 15:35:23 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-12-30 15:35:23 (GMT) |
commit | 9e0633c91090e3254056b33bf8bd1ec4533982a6 (patch) | |
tree | f680ede529eb7bb1c7739884038499e4b6229356 /Utilities/cmtar/append.c | |
parent | bc447c7f92730303c16d34cbe3747854b4c776c3 (diff) | |
download | CMake-9e0633c91090e3254056b33bf8bd1ec4533982a6.zip CMake-9e0633c91090e3254056b33bf8bd1ec4533982a6.tar.gz CMake-9e0633c91090e3254056b33bf8bd1ec4533982a6.tar.bz2 |
BUG: Several Borland fixes
Diffstat (limited to 'Utilities/cmtar/append.c')
-rw-r--r-- | Utilities/cmtar/append.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Utilities/cmtar/append.c b/Utilities/cmtar/append.c index 6dbf1dd..6bcef98 100644 --- a/Utilities/cmtar/append.c +++ b/Utilities/cmtar/append.c @@ -69,8 +69,10 @@ tar_append_file(TAR *t, char *realname, char *savename) tar_ino_t *ti = NULL; #if !defined(_WIN32) || defined(__CYGWIN__) int i; - char path[TAR_MAXPATHLEN]; +#else + size_t plen; #endif + char path[TAR_MAXPATHLEN]; #ifdef DEBUG printf("==> tar_append_file(TAR=0x%lx (\"%s\"), realname=\"%s\", " @@ -79,7 +81,14 @@ tar_append_file(TAR *t, char *realname, char *savename) #endif #if defined(_WIN32) && !defined(__CYGWIN__) - if (stat(realname, &s) != 0) + strncpy(path, realname, sizeof(path)-1); + path[sizeof(path)-1] = 0; + plen = strlen(path); + if (path[plen-1] == '/' ) + { + path[plen-1] = 0; + } + if (stat(path, &s) != 0) #else if (lstat(realname, &s) != 0) #endif @@ -126,6 +135,7 @@ tar_append_file(TAR *t, char *realname, char *savename) return -1; } libtar_hashptr_reset(&hp); +#if !defined(_WIN32) || defined(__CYGWIN__) if (libtar_hash_getkey(td->td_h, &hp, &(s.st_ino), (libtar_matchfunc_t)ino_match) != 0) { @@ -138,6 +148,7 @@ tar_append_file(TAR *t, char *realname, char *savename) th_set_link(t, ti->ti_name); } else +#endif { #ifdef DEBUG printf("+++ adding entry: device (0x%lx,0x%lx), inode %ld " |