Skip to content

Commit

Permalink
QA: Softtabs issues
Browse files Browse the repository at this point in the history
QA: One exception process test.

git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti/spine/branches/0.8.7@5603 860744bd-22fc-0310-8c96-e9fe5004b5ca
  • Loading branch information
TheWitness committed Jan 16, 2010
1 parent e66c8e5 commit 3ba064b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
28 changes: 14 additions & 14 deletions nft_popen.c
Expand Up @@ -102,7 +102,7 @@ static void close_cleanup(void *);
int nft_popen(const char * command, const char * type) {
struct pid *cur;
struct pid *p;
int pdes[2];
int pdes[2];
int fd, pid, twoway;
char *argv[4];
int cancel_state;
Expand All @@ -123,7 +123,7 @@ int nft_popen(const char * command, const char * type) {
}
}

if (pipe(pdes) < 0)
if (pipe(pdes) < 0)
return -1;

/* Disable thread cancellation from this point forward. */
Expand All @@ -146,7 +146,7 @@ int nft_popen(const char * command, const char * type) {
*/
pthread_mutex_lock(&ListMutex);

/* Fork. */
/* Fork. */
retry:
switch (pid = vfork()) {
case -1: /* Error. */
Expand Down Expand Up @@ -192,7 +192,7 @@ int nft_popen(const char * command, const char * type) {
* general, since the _exit() is no return, so
* the compiler is free to corrupt all the local
* variables.
*/
*/
(void)close(pdes[0]);
if (pdes[1] != STDOUT_FILENO) {
(void)dup2(pdes[1], STDOUT_FILENO);
Expand Down Expand Up @@ -230,7 +230,7 @@ int nft_popen(const char * command, const char * type) {
}

/* Parent. */
if (*type == 'r') {
if (*type == 'r') {
fd = pdes[0];
(void)close(pdes[1]);
}else {
Expand Down Expand Up @@ -276,7 +276,7 @@ int nft_pchild(int fd) {
break;
}

pthread_mutex_unlock(&ListMutex);
pthread_mutex_unlock(&ListMutex);

if (cur == NULL) {
errno = EBADF;
Expand Down Expand Up @@ -356,23 +356,23 @@ close_cleanup(void * arg)
(void)close(cur->fd);
}

/* Remove the entry from the linked list. */
pthread_mutex_lock(&ListMutex);
/* Remove the entry from the linked list. */
pthread_mutex_lock(&ListMutex);

if (PidList == cur) {
PidList = cur->next;
}else{
}else{
for (prev = PidList; prev; prev = prev->next)
if (prev->next == cur) {
if (prev->next == cur) {
prev->next = cur->next;
break;
}
}

assert(prev != NULL); /* Search should not fail */
}
}

pthread_mutex_unlock(&ListMutex);
pthread_mutex_unlock(&ListMutex);

free(cur);
free(cur);
}

6 changes: 5 additions & 1 deletion php.c
Expand Up @@ -178,8 +178,12 @@ char *php_readpipe(int php_process) {
switch (errno) {
case EBADF:
SPINE_LOG(("ERROR: SS[%i] An invalid file descriptor was given in one of the sets.", php_process));
SET_UNDEFINED(result_string);

/* kill script server because it is misbehaving likely due to a server crash */
php_close(php_process);
php_init(php_process);
break;
case EAGAIN:
case EINTR:
#ifndef SOLAR_THREAD
/* take a moment */
Expand Down
2 changes: 0 additions & 2 deletions poller.c
Expand Up @@ -1323,7 +1323,6 @@ char *exec_poll(host_t *current_host, char *command) {
SPINE_LOG_DEBUG(("Host[%i] DEBUG: The NIFTY POPEN returned the following File Descriptor %i", current_host->id, cmd_fd));
#endif


if (cmd_fd > 0) {
/* Initialize File Descriptors to Review for Input/Output */
FD_ZERO(&fds);
Expand All @@ -1339,7 +1338,6 @@ char *exec_poll(host_t *current_host, char *command) {
SET_UNDEFINED(result_string);
close_fd = FALSE;
break;
case EAGAIN:
case EINTR:
#ifndef SOLAR_THREAD
/* take a moment */
Expand Down

0 comments on commit 3ba064b

Please sign in to comment.