fixed 64bit issue with file descriptor

This commit is contained in:
Martin Willi
2007-09-13 08:19:15 +00:00
parent 367f9f01f7
commit 6baca3b2f1
@@ -290,6 +290,14 @@ static void request(xmlTextReaderPtr reader, char *id, int fd)
xmlFreeTextWriter(writer); xmlFreeTextWriter(writer);
} }
/**
* cleanup helper function for open file descriptors
*/
static void closefdp(int *fd)
{
close(*fd);
}
/** /**
* read from a opened connection and process it * read from a opened connection and process it
*/ */
@@ -301,7 +309,7 @@ static job_requeue_t process(int *fdp)
xmlTextReaderPtr reader; xmlTextReaderPtr reader;
char *id = NULL, *type = NULL; char *id = NULL, *type = NULL;
pthread_cleanup_push((void*)close, (void*)fd); pthread_cleanup_push((void*)closefdp, (void*)&fd);
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate);
len = read(fd, buffer, sizeof(buffer)); len = read(fd, buffer, sizeof(buffer));
pthread_setcancelstate(oldstate, NULL); pthread_setcancelstate(oldstate, NULL);