[Pkg-owncloud-commits] [owncloud-client] 72/218: vio_local_win: Properly set errno in case of error happened.
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Oct 17 14:30:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 02c077e3f8a33bdc457418af1046559b065e794c
Author: Klaas Freitag <freitag at owncloud.com>
Date: Wed Sep 9 14:10:23 2015 +0200
vio_local_win: Properly set errno in case of error happened.
Without a proper errno value, the calling function can not detect
the kind of problem.
---
csync/src/vio/csync_vio_local_win.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/csync/src/vio/csync_vio_local_win.c b/csync/src/vio/csync_vio_local_win.c
index 8f55356..7cd9ea8 100644
--- a/csync/src/vio/csync_vio_local_win.c
+++ b/csync/src/vio/csync_vio_local_win.c
@@ -74,6 +74,12 @@ csync_vio_handle_t *csync_vio_local_opendir(const char *name) {
}
if (!dirname || handle->hFind == INVALID_HANDLE_VALUE) {
+ int retcode = GetLastError();
+ if( retcode == ERROR_FILE_NOT_FOUND ) {
+ errno = ENOENT;
+ } else {
+ errno = EACCES;
+ }
SAFE_FREE(handle);
return NULL;
}
@@ -99,6 +105,9 @@ int csync_vio_local_closedir(csync_vio_handle_t *dhandle) {
// FindClose returns non-zero on success
if( FindClose(handle->hFind) != 0 ) {
rc = 0;
+ } else {
+ // error case, set errno
+ errno = EBADF;
}
SAFE_FREE(handle->path);
@@ -117,7 +126,8 @@ csync_vio_file_stat_t *csync_vio_local_readdir(csync_vio_handle_t *dhandle) {
errno = 0;
file_stat = csync_vio_file_stat_new();
if (file_stat == NULL) {
- goto err;
+ errno = ENOMEM;
+ goto err;
}
file_stat->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list