diff --git a/src/Cedar/BridgeUnix.c b/src/Cedar/BridgeUnix.c index 797f6fcd..50a0c0bd 100644 --- a/src/Cedar/BridgeUnix.c +++ b/src/Cedar/BridgeUnix.c @@ -2664,7 +2664,7 @@ void EthPutPacketLinuxIpRaw(ETH *e, void *data, UINT size) p = ParsePacket(data, size); - if (p && p->BroadcastPacket || Cmp(p->MacAddressDest, e->RawIpMyMacAddr, 6) == 0) + if (p != NULL && p->BroadcastPacket || Cmp(p->MacAddressDest, e->RawIpMyMacAddr, 6) == 0) { if (IsValidUnicastMacAddress(p->MacAddressSrc)) { diff --git a/src/Cedar/Protocol.c b/src/Cedar/Protocol.c index 9ea4b34d..665498e4 100644 --- a/src/Cedar/Protocol.c +++ b/src/Cedar/Protocol.c @@ -5645,7 +5645,7 @@ void ClientUploadNoop(CONNECTION *c) p = PackError(0); PackAddInt(p, "noop", 1); - HttpClientSend(c->FirstSock, p); + (void)HttpClientSend(c->FirstSock, p); FreePack(p); p = HttpClientRecv(c->FirstSock); @@ -5942,15 +5942,12 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str) UINT num = 0, max = 19; SERVER *server; char *vpn_http_target = HTTP_VPN_TARGET2; - bool check_hostname = false; // Validate arguments if (c == NULL) { return false; } - - server = c->Cedar->Server; s = c->FirstSock; @@ -5977,33 +5974,6 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str) return false; } - if (check_hostname && (StrCmpi(h->Version, "HTTP/1.1") == 0 || StrCmpi(h->Version, "HTTP/1.2") == 0)) - { - HTTP_VALUE *v; - char hostname[64]; - - Zero(hostname, sizeof(hostname)); - - v = GetHttpValue(h, "Host"); - if (v != NULL) - { - StrCpy(hostname, sizeof(hostname), v->Data); - } - - if (IsEmptyStr(hostname)) - { - // Invalid hostname - HttpSendInvalidHostname(s, h->Target); - FreeHttpHeader(h); - c->Err = ERR_CLIENT_IS_NOT_VPN; - *error_detail_str = "Invalid_hostname"; - return false; - } - } - - - - // Interpret if (StrCmpi(h->Method, "POST") == 0) { diff --git a/src/Cedar/Virtual.c b/src/Cedar/Virtual.c index b02325f5..3c503f54 100644 --- a/src/Cedar/Virtual.c +++ b/src/Cedar/Virtual.c @@ -1072,9 +1072,9 @@ void NnFragmentedIpReceived(NATIVE_NAT *t, PKT *packet) c = NnInsertIpCombine( t, ip->SrcIP, ip->DstIP, Endian16(ip->Identification), ip->Protocol, packet->BroadcastPacket, ip->TimeToLive, false); - c->MaxL3Size = MAX(c->MaxL3Size, l3_size); if (c != NULL) { + c->MaxL3Size = MAX(c->MaxL3Size, l3_size); NnCombineIp(t, c, offset, data, size, last_packet, head_ip_header_data, head_ip_header_size); } } diff --git a/src/Mayaqua/Unix.c b/src/Mayaqua/Unix.c index 73a999ed..b91b1573 100755 --- a/src/Mayaqua/Unix.c +++ b/src/Mayaqua/Unix.c @@ -178,7 +178,7 @@ int local_scandir(const char *dir, struct dirent ***namelist, *namelist=NULL; while ((entry=readdir(d)) != NULL) { - if (select == NULL || (select != NULL && (*select)(entry))) + if (select == NULL || (*select)(entry)) { *namelist=(struct dirent **)realloc((void *)(*namelist), (size_t)((i+1)*sizeof(struct dirent *))); @@ -516,7 +516,7 @@ void UnixInitSolarisSleep() char tmp[MAX_SIZE]; UnixNewPipe(&solaris_sleep_p1, &solaris_sleep_p2); - read(solaris_sleep_p1, tmp, sizeof(tmp)); + (void)read(solaris_sleep_p1, tmp, sizeof(tmp)); } // Release the Sleep for Solaris @@ -540,17 +540,6 @@ void UnixSolarisSleep(UINT msec) } // Get the free space of the disk -bool UnixGetDiskFreeW(wchar_t *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) -{ - char *path_a = CopyUniToStr(path); - bool ret; - - ret = UnixGetDiskFree(path_a, free_size, used_size, total_size); - - Free(path_a); - - return ret; -} bool UnixGetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) { char tmp[MAX_PATH]; @@ -803,42 +792,6 @@ void UnixSetThreadPriorityRealtime() pthread_setschedparam(pthread_self(), SCHED_RR, &p); } -// Lower the priority of the thread -void UnixSetThreadPriorityLow() -{ - struct sched_param p; - Zero(&p, sizeof(p)); - p.sched_priority = 32; - pthread_setschedparam(pthread_self(), SCHED_OTHER, &p); -} - -// Raise the priority of the thread -void UnixSetThreadPriorityHigh() -{ - struct sched_param p; - Zero(&p, sizeof(p)); - p.sched_priority = 127; - pthread_setschedparam(pthread_self(), SCHED_RR, &p); -} - -// Set the priority of the thread to idle -void UnixSetThreadPriorityIdle() -{ - struct sched_param p; - Zero(&p, sizeof(p)); - p.sched_priority = 1; - pthread_setschedparam(pthread_self(), SCHED_OTHER, &p); -} - -// Restore the priority of the thread to normal -void UnixRestoreThreadPriority() -{ - struct sched_param p; - Zero(&p, sizeof(p)); - p.sched_priority = 64; - pthread_setschedparam(pthread_self(), SCHED_OTHER, &p); -} - // Get the current directory void UnixGetCurrentDir(char *dir, UINT size) { @@ -899,7 +852,7 @@ void UnixFreeSingleInstance(void *data) lock.l_type = F_UNLCK; lock.l_whence = SEEK_SET; - fcntl(o->fd, F_SETLK, &lock); + (void)fcntl(o->fd, F_SETLK, &lock); close(o->fd); remove(o->FileName); @@ -947,7 +900,7 @@ void *UnixNewSingleInstance(char *instance_name) } fchmod(fd, mode); - chmod(name, mode); + (void)chmod(name, mode); Zero(&lock, sizeof(lock)); lock.l_type = F_WRLCK; @@ -1293,43 +1246,6 @@ bool UnixRun(char *filename, char *arg, bool hide, bool wait) } } -// Initialize the daemon -void UnixDaemon(bool debug_mode) -{ - UINT ret; - - if (debug_mode) - { - // Debug mode - signal(SIGHUP, SIG_IGN); - return; - } - - ret = fork(); - - if (ret == -1) - { - // Error - return; - } - else if (ret == 0) - { - // Create a new session for the child process - setsid(); - - // Close the standard I/O - UnixCloseIO(); - - // Mute the unwanted signal - signal(SIGHUP, SIG_IGN); - } - else - { - // Terminate the parent process - exit(0); - } -} - // Close the standard I/O void UnixCloseIO() { @@ -1826,7 +1742,7 @@ bool UnixInitThread(THREAD *t) { // An error has occured t->pData = NULL; - Release(t->ref); + (void)Release(t->ref); UnixMemoryFree(ut); UnixMemoryFree(info); pthread_attr_destroy(&attr); @@ -2640,8 +2556,6 @@ void UnixStopService(char *name) } else { - int status; - // Stop the service UniPrint(_UU("UNIX_SVC_STOPPING"), svc_title); @@ -2802,10 +2716,6 @@ bool UnixWaitProcessEx(UINT pid, UINT timeout) } return true; } -void UnixWaitProcess(UINT pid) -{ - UnixWaitProcessEx(pid, INFINITE); -} // Description of how to start void UnixUsage(char *name) diff --git a/src/Mayaqua/Unix.h b/src/Mayaqua/Unix.h index ed6d719e..fa0f27d9 100644 --- a/src/Mayaqua/Unix.h +++ b/src/Mayaqua/Unix.h @@ -218,16 +218,11 @@ void UnixSetEnableKernelEspProcessing(bool b); void UnixDisableCoreDump(); void UnixSetThreadPriorityRealtime(); -void UnixSetThreadPriorityLow(); -void UnixSetThreadPriorityHigh(); -void UnixSetThreadPriorityIdle(); -void UnixRestoreThreadPriority(); void UnixSetResourceLimit(UINT id, UINT64 value); bool UnixIs64BitRlimSupported(); UINT64 UnixGetTick64(); void UnixSigChldHandler(int sig); void UnixCloseIO(); -void UnixDaemon(bool debug_mode); void UnixGetCurrentDir(char *dir, UINT size); void UnixGetCurrentDirW(wchar_t *dir, UINT size); bool UnixCheckExecAccess(char *name); @@ -236,7 +231,6 @@ DIRLIST *UnixEnumDirEx(char *dirname, COMPARE *compare); DIRLIST *UnixEnumDirExW(wchar_t *dirname, COMPARE *compare); bool UnixGetDiskFreeMain(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); bool UnixGetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); -bool UnixGetDiskFreeW(wchar_t *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); void UnixInitSolarisSleep(); void UnixFreeSolarisSleep(); void UnixSolarisSleep(UINT msec); @@ -255,7 +249,6 @@ UINT UnixReadPidFile(); UINT UnixReadCtlFile(); bool UnixIsProcess(UINT pid); bool UnixWaitProcessEx(UINT pid, UINT timeout); -void UnixWaitProcess(UINT pid); void UnixDeletePidFile(); void UnixDeleteCtlFile(); void UnixStopThread(THREAD *t, void *param);