Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/handle windows directory junction #7609

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/csync/vio/csync_vio_local_win.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check notice on line 1 in src/csync/vio/csync_vio_local_win.cpp

View workflow job for this annotation

GitHub Actions / build

Run clang-format on src/csync/vio/csync_vio_local_win.cpp

File src/csync/vio/csync_vio_local_win.cpp does not conform to Custom style guidelines. (lines 164, 165)
* libcsync -- a library to sync a directory with another
*
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
Expand Down Expand Up @@ -27,7 +27,7 @@

#include <memory>

#include "windows.h"

Check failure on line 30 in src/csync/vio/csync_vio_local_win.cpp

View workflow job for this annotation

GitHub Actions / build

src/csync/vio/csync_vio_local_win.cpp:30:10 [clang-diagnostic-error]

'windows.h' file not found

#include "c_private.h"
#include "c_lib.h"
Expand Down Expand Up @@ -144,7 +144,7 @@

const auto isDirectory = handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;

if (vfs && vfs->statTypeVirtualFile(file_stat.get(), &handle->ffd)) {

Check warning on line 147 in src/csync/vio/csync_vio_local_win.cpp

View workflow job for this annotation

GitHub Actions / build

src/csync/vio/csync_vio_local_win.cpp:147:73 [bugprone-branch-clone]

repeated branch in conditional chain
// all good
} else if ((handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && !isDirectory) {
// Detect symlinks, and treat junctions as symlinks too.
Expand All @@ -161,7 +161,13 @@
!isDirectory) {
file_stat->type = ItemTypeSkip;
} else if (isDirectory) {
file_stat->type = ItemTypeDirectory;
if (handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT &&

Check warning on line 164 in src/csync/vio/csync_vio_local_win.cpp

View workflow job for this annotation

GitHub Actions / build

src/csync/vio/csync_vio_local_win.cpp:164:9 [bugprone-branch-clone]

if with identical then and else branches
(handle->ffd.dwReserved0 == IO_REPARSE_TAG_SYMLINK ||
handle->ffd.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT)) {
file_stat->type = ItemTypeSoftLink;
} else {
file_stat->type = ItemTypeDirectory;
}
} else {
file_stat->type = ItemTypeFile;
}
Expand Down
Loading