]> sourceware.org Git - lvm2.git/commitdiff
Fix last pthread_join fix commit
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 22 Dec 2010 14:00:28 +0000 (14:00 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 22 Dec 2010 14:00:28 +0000 (14:00 +0000)
Call for pthread_join() does not set errno value even though return values
looks like that. For now assign errno from return value and still use
strerror() to print some error message as this seems to be commonly used.

Add also log_sys_error() message for error close of local pipe.

daemons/clvmd/clvmd.c

index ae4da65c3d47c759dfd15d6831c837e59f251fba..327a1fb5b5a9b27f06a2a34cde31860af00ef2c9 100644 (file)
@@ -667,7 +667,8 @@ static int local_pipe_callback(struct local_client *thisfd, char *buf,
        /* EOF on pipe or an error, close it */
        if (len <= 0) {
                void *ret = &status;
-               close(thisfd->fd);
+               if (close(thisfd->fd))
+                       log_sys_error("close", "local_pipe");
 
                /* Clear out the cross-link */
                if (thisfd->bits.pipe.client != NULL)
@@ -676,7 +677,8 @@ static int local_pipe_callback(struct local_client *thisfd, char *buf,
 
                /* Reap child thread */
                if (thisfd->bits.pipe.threadid) {
-                       if (pthread_join(thisfd->bits.pipe.threadid, &ret))
+                       if ((errno = pthread_join(thisfd->bits.pipe.threadid,
+                                                 &ret)))
                                log_sys_error("pthread_join", "");
 
                        thisfd->bits.pipe.threadid = 0;
@@ -1068,8 +1070,8 @@ static int read_from_local_sock(struct local_client *thisfd)
                        pthread_cond_signal(&thisfd->bits.localsock.cond);
                        pthread_mutex_unlock(&thisfd->bits.localsock.mutex);
 
-                       if (pthread_join(thisfd->bits.localsock.threadid,
-                                        (void **) &status))
+                       if ((errno = pthread_join(thisfd->bits.localsock.threadid,
+                                                 (void **) &status)))
                                log_sys_error("pthread_join", "");
 
                        DEBUGLOG("Joined child thread\n");
This page took 0.044827 seconds and 5 git commands to generate.