Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
HAMANO Tsukasa
OpenLDAP
Commits
3e7a8e26
Commit
3e7a8e26
authored
Oct 20, 2016
by
Lorenz Bauer
Committed by
Hallvard Furuseth
Dec 13, 2016
Browse files
ITS#8504 mdb_env_copyfd2(): Don't abort on SIGPIPE
Return EPIPE instead.
parent
65e95ffc
Changes
1
Show whitespace changes
Inline
Side-by-side
libraries/liblmdb/mdb.c
View file @
3e7a8e26
...
@@ -160,6 +160,7 @@ typedef SSIZE_T ssize_t;
...
@@ -160,6 +160,7 @@ typedef SSIZE_T ssize_t;
#ifndef _WIN32
#ifndef _WIN32
#include <pthread.h>
#include <pthread.h>
#include <signal.h>
#ifdef MDB_USE_POSIX_SEM
#ifdef MDB_USE_POSIX_SEM
# define MDB_USE_HASH 1
# define MDB_USE_HASH 1
#include <semaphore.h>
#include <semaphore.h>
...
@@ -9786,10 +9787,17 @@ mdb_env_copythr(void *arg)
...
@@ -9786,10 +9787,17 @@ mdb_env_copythr(void *arg)
#define DO_WRITE(rc, fd, ptr, w2, len) rc = WriteFile(fd, ptr, w2, &len, NULL)
#define DO_WRITE(rc, fd, ptr, w2, len) rc = WriteFile(fd, ptr, w2, &len, NULL)
#else
#else
int len;
int len;
sigset_t set;
#define DO_WRITE(rc, fd, ptr, w2, len) len = write(fd, ptr, w2); rc = (len >= 0)
#define DO_WRITE(rc, fd, ptr, w2, len) len = write(fd, ptr, w2); rc = (len >= 0)
sigemptyset(&set);
sigaddset(&set, SIGPIPE);
#endif
#endif
pthread_mutex_lock(&my->mc_mutex);
pthread_mutex_lock(&my->mc_mutex);
#ifndef _WIN32
my->mc_error = pthread_sigmask(SIG_BLOCK, &set, NULL);
#endif
for(;;) {
for(;;) {
while (!my->mc_new)
while (!my->mc_new)
pthread_cond_wait(&my->mc_cond, &my->mc_mutex);
pthread_cond_wait(&my->mc_cond, &my->mc_mutex);
...
@@ -9803,6 +9811,12 @@ again:
...
@@ -9803,6 +9811,12 @@ again:
DO_WRITE(rc, my->mc_fd, ptr, wsize, len);
DO_WRITE(rc, my->mc_fd, ptr, wsize, len);
if (!rc) {
if (!rc) {
rc = ErrCode();
rc = ErrCode();
#ifndef _WIN32
if (rc == EPIPE) {
int tmp;
sigwait(&set, &tmp);
}
#endif
break;
break;
} else if (len > 0) {
} else if (len > 0) {
rc = MDB_SUCCESS;
rc = MDB_SUCCESS;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment