Skip to content

Commit

Permalink
Fix root directory stat() call.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed May 14, 2014
1 parent ea9a242 commit e06acd0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/win32/compat/compat.c
Expand Up @@ -435,6 +435,8 @@ static POOLMEM *make_wchar_win32_path(POOLMEM *pszUCSPath, BOOL *pBIsRawPath /*=

wchar_t *win32_name = &pwszBuf[nParseOffset];
wchar_t *name_start = name;
wchar_t previous_char = 0;
wchar_t next_char = 0;

while (*name) {
/*
Expand All @@ -444,10 +446,12 @@ static POOLMEM *make_wchar_win32_path(POOLMEM *pszUCSPath, BOOL *pBIsRawPath /*=
/*
* Don't add a trailing slash.
*/
if (!*(name + 1)) {
next_char = *(name + 1);
if (previous_char != ':' && next_char == '\0') {
name++;
continue;
}
previous_char = '\\';
*win32_name++ = '\\'; /* convert char */

/*
Expand All @@ -457,6 +461,7 @@ static POOLMEM *make_wchar_win32_path(POOLMEM *pszUCSPath, BOOL *pBIsRawPath /*=
name++;
}
} else {
previous_char = *name;
*win32_name++ = *name; /* copy character */
}
name++;
Expand Down Expand Up @@ -1159,8 +1164,8 @@ int fstat(intptr_t fd, struct stat *sb)
Dmsg1(dbglvl, "st_nlink=%d\n", sb->st_nlink);
}

sb->st_mode |= S_IFREG;
sb->st_mode = 0777;
sb->st_mode |= S_IFREG;

/*
* See if we need to encode in the old Bacula compatible way.
Expand Down

0 comments on commit e06acd0

Please sign in to comment.