diff options
Diffstat (limited to 'nsprpub/pr/src/md/unix')
-rw-r--r-- | nsprpub/pr/src/md/unix/unix.c | 22 | ||||
-rw-r--r-- | nsprpub/pr/src/md/unix/uxproces.c | 22 | ||||
-rw-r--r-- | nsprpub/pr/src/md/unix/uxshm.c | 44 |
3 files changed, 45 insertions, 43 deletions
diff --git a/nsprpub/pr/src/md/unix/unix.c b/nsprpub/pr/src/md/unix/unix.c index fdae1199c..662f561b6 100644 --- a/nsprpub/pr/src/md/unix/unix.c +++ b/nsprpub/pr/src/md/unix/unix.c @@ -3316,11 +3316,11 @@ int _MD_unix_get_nonblocking_connect_error(int osfd) return errno; } else { return err; - } + } } } else { return ECONNREFUSED; - } + } #elif defined(UNIXWARE) /* * getsockopt() fails with EPIPE, so use getmsg() instead. @@ -3331,17 +3331,17 @@ int _MD_unix_get_nonblocking_connect_error(int osfd) rv = getmsg(osfd, NULL, NULL, &flags); PR_ASSERT(-1 == rv || 0 == rv); if (-1 == rv && errno != EAGAIN && errno != EWOULDBLOCK) { - return errno; + return errno; } - return 0; /* no error */ + return 0; /* no error */ #else - int err; - _PRSockLen_t optlen = sizeof(err); - if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char *) &err, &optlen) == -1) { - return errno; - } else { - return err; - } + int err; + _PRSockLen_t optlen = sizeof(err); + if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char*)&err, &optlen) == -1) { + return errno; + } + return err; + #endif } diff --git a/nsprpub/pr/src/md/unix/uxproces.c b/nsprpub/pr/src/md/unix/uxproces.c index a3b35e540..5286b9e18 100644 --- a/nsprpub/pr/src/md/unix/uxproces.c +++ b/nsprpub/pr/src/md/unix/uxproces.c @@ -247,13 +247,14 @@ ForkAndExec( PR_DELETE(newEnvp); } return NULL; - } else if (0 == process->md.pid) { /* the child process */ - /* - * If the child process needs to exit, it must call _exit(). - * Do not call exit(), because exit() will flush and close - * the standard I/O file descriptors, and hence corrupt - * the parent process's standard I/O data structures. - */ + } + if (0 == process->md.pid) { /* the child process */ + /* + * If the child process needs to exit, it must call _exit(). + * Do not call exit(), because exit() will flush and close + * the standard I/O file descriptors, and hence corrupt + * the parent process's standard I/O data structures. + */ #if !defined(NTO) && !defined(SYMBIAN) if (attr) { @@ -498,10 +499,9 @@ ExtractExitStatus(int rawExitStatus) #endif if (WIFEXITED(rawExitStatus)) { return WEXITSTATUS(rawExitStatus); - } else { + } PR_ASSERT(WIFSIGNALED(rawExitStatus)); return _PR_SIGNALED_EXITSTATUS; - } } static void @@ -624,8 +624,8 @@ static void WaitPidDaemonThread(void *unused) } while (sizeof(buf) == rv || (-1 == rv && EINTR == errno)); #ifdef _PR_SHARE_CLONES - PR_Unlock(pr_wp.ml); while ((op = pr_wp.opHead) != NULL) { + PR_Unlock(pr_wp.ml); op->process = ForkAndExec(op->path, op->argv, op->envp, op->attr); if (NULL == op->process) { @@ -639,8 +639,8 @@ static void WaitPidDaemonThread(void *unused) } op->done = PR_TRUE; PR_NotifyCondVar(op->doneCV); - PR_Unlock(pr_wp.ml); } + PR_Unlock(pr_wp.ml); #endif while (1) { diff --git a/nsprpub/pr/src/md/unix/uxshm.c b/nsprpub/pr/src/md/unix/uxshm.c index dec4e3a7a..54e68191c 100644 --- a/nsprpub/pr/src/md/unix/uxshm.c +++ b/nsprpub/pr/src/md/unix/uxshm.c @@ -76,8 +76,8 @@ extern PRSharedMemory * _MD_OpenSharedMemory( /* copy args to struct */ strcpy( shm->ipcname, ipcname ); - shm->size = size; - shm->mode = mode; + shm->size = size; + shm->mode = mode; shm->flags = flags; shm->ident = _PR_SHM_IDENT; @@ -500,30 +500,32 @@ extern PRFileMap* _md_OpenAnonFileMap( ("_md_OpenAnonFileMap(): PR_snprintf(): failed, generating filename")); goto Finished; } - + /* create the file */ - osfd = open( genName, (O_CREAT | O_EXCL | O_RDWR), mode ); - if ( -1 == osfd ) { - if ( EEXIST == errno ) { - PR_smprintf_free( genName ); - continue; /* name exists, try again */ - } else { - _PR_MD_MAP_OPEN_ERROR( errno ); - PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, - ("_md_OpenAnonFileMap(): open(): failed, filename: %s, errno: %d", - genName, PR_GetOSError())); - PR_smprintf_free( genName ); - goto Finished; - } + osfd = open(genName, (O_CREAT | O_EXCL | O_RDWR), mode); + if (-1 == osfd) { + if (EEXIST == errno) { + PR_smprintf_free(genName); + continue; /* name exists, try again */ + } + _PR_MD_MAP_OPEN_ERROR(errno); + PR_LOG( + _pr_shma_lm, + PR_LOG_DEBUG, + ("_md_OpenAnonFileMap(): open(): failed, filename: %s, errno: %d", + genName, + PR_GetOSError())); + PR_smprintf_free(genName); + goto Finished; } break; /* name generation and open successful, break; */ } /* end for() */ - if ( incr == maxTries ) { - PR_ASSERT( -1 == osfd ); - PR_ASSERT( EEXIST == errno ); - _PR_MD_MAP_OPEN_ERROR( errno ); - goto Finished; + if (incr == maxTries) { + PR_ASSERT(-1 == osfd); + PR_ASSERT(EEXIST == errno); + _PR_MD_MAP_OPEN_ERROR(errno); + goto Finished; } urc = unlink( genName ); |