]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3535. [bug] Minor win32 cleanups. [RT #32962]
authorMark Andrews <marka@isc.org>
Fri, 22 Mar 2013 11:23:48 +0000 (22:23 +1100)
committerMark Andrews <marka@isc.org>
Fri, 22 Mar 2013 11:23:48 +0000 (22:23 +1100)
CHANGES
lib/isc/win32/dir.c
lib/isc/win32/entropy.c
lib/isc/win32/file.c
lib/isc/win32/fsaccess.c
lib/isc/win32/net.c
lib/isc/win32/ntgroups.c
lib/isc/win32/os.c
lib/isc/win32/socket.c
lib/isc/win32/win32os.c
lib/lwres/win32/lwconfig.c

diff --git a/CHANGES b/CHANGES
index b81db912f85c669a8994ea42fd0a6070b04bfc10..a94d624b645d03d02c643b53eb8d1881539cf2ca 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+3535.  [bug]           Minor win32 cleanups. [RT #32962]
+
 3534.  [bug]           Extra text after an embedded NULL was ignored when
                        parsing zone files. [RT #32699]
 
index 14fadde46af38275b72295f536be92245fac1298..d6a0bb3e44594dc62219ddd23963ea6577d895ac 100644 (file)
@@ -267,7 +267,8 @@ isc_dir_createunique(char *templet) {
 
        do {
                i = mkdir(templet);
-               i = chmod(templet, 0700);
+               if (i == 0)
+                       i = chmod(templet, 0700);
 
                if (i == 0 || errno != EEXIST)
                        break;
index 5a316e6e5cff04deaab30cd6a8387adc5109a75f..e329ab7e4a2bcd6357eb2c2d49a6c9ac35ef15f9 100644 (file)
@@ -242,7 +242,6 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
        isc_result_t ret;
        isc_entropysource_t *source;
        HCRYPTPROV hcryptprov;
-       DWORD errval;
        BOOL err;
 
        REQUIRE(VALID_ENTROPY(ent));
@@ -258,7 +257,7 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
        err = CryptAcquireContext(&hcryptprov, NULL, NULL, PROV_RSA_FULL,
                                  CRYPT_VERIFYCONTEXT);
        if (!err){
-               errval = GetLastError();
+               (void)GetLastError();
                ret = ISC_R_IOERROR;
                goto errout;
        }
index bcbb2bb9fa2ffe573599b2c3237f2ba5c68823cd..ac9a035f1cd699bedac6c23b0871a98f12533618 100644 (file)
@@ -210,7 +210,7 @@ isc_file_safemovefile(const char *oldname, const char *newname) {
                tmpfd = mkstemp(buf, ISC_TRUE);
                if (tmpfd > 0)
                        _close(tmpfd);
-               DeleteFile(buf);
+               (void)DeleteFile(buf);
                _chmod(newname, _S_IREAD | _S_IWRITE);
 
                filestatus = MoveFile(newname, buf);
@@ -237,7 +237,7 @@ isc_file_safemovefile(const char *oldname, const char *newname) {
         * Delete the backup file if it got created
         */
        if (exists == TRUE)
-               filestatus = DeleteFile(buf);
+               (void)DeleteFile(buf);
        return (0);
 }
 
@@ -335,7 +335,7 @@ isc_file_template(const char *path, const char *templet, char *buf,
 
 isc_result_t
 isc_file_renameunique(const char *file, char *templet) {
-       int fd = -1;
+       int fd
        int res = 0;
        isc_result_t result = ISC_R_SUCCESS;
 
index 8de793f0a8582e258268d1a2c8207975a1752f62..98205409363f797907bb23f777be6686fa133fd3 100644 (file)
@@ -168,7 +168,6 @@ NTFS_Access_Control(const char *filename, const char *user, int access,
        char domainBuffer[100];
        DWORD domainBufferSize = sizeof(domainBuffer);
        SID_NAME_USE snu;
-       int errval;
        DWORD NTFSbits;
        int caccess;
 
@@ -184,13 +183,13 @@ NTFS_Access_Control(const char *filename, const char *user, int access,
        domainBufferSize = sizeof(domainBuffer);
        if (!LookupAccountName(0, "Administrators", padminsid,
                &adminSidBufferSize, domainBuffer, &domainBufferSize, &snu)) {
-               errval = GetLastError();
+               (void)GetLastError();
                return (ISC_R_NOPERM);
        }
        domainBufferSize = sizeof(domainBuffer);
        if (!LookupAccountName(0, "Everyone", pothersid,
                &otherSidBufferSize, domainBuffer, &domainBufferSize, &snu)) {
-               errval = GetLastError();
+               (void)GetLastError();
                return (ISC_R_NOPERM);
        }
 
@@ -287,7 +286,7 @@ NTFS_fsaccess_set(const char *path, isc_fsaccess_t access,
         * For NTFS we first need to get the name of the account under
         * which BIND is running
         */
-       if (namelen <= 0) {
+       if (namelen == 0) {
                namelen = sizeof(username);
                if (GetUserName(username, &namelen) == 0)
                        return (ISC_R_FAILURE);
index 06d09819e662811acdd31193771b616d1ac7d3c3..a41641e62904edcdf92f5ec0743cf87cec3d87fd 100644 (file)
@@ -64,7 +64,6 @@ void InitSockets(void);
 static isc_result_t
 try_proto(int domain) {
        SOCKET s;
-       isc_result_t result = ISC_R_SUCCESS;
        char strbuf[ISC_STRERRORSIZE];
        int errval;
 
index 729cf07e74f0e026226374c9620ccd95f1632ba1..7f92a50bfcb365da4c9e0fc64a5e25dda7d73cf9 100644 (file)
@@ -62,7 +62,6 @@ isc_ntsecurity_getaccountgroups(char *username, char **GroupList,
        DWORD dwEntriesRead = 0;
        DWORD dwTotalEntries = 0;
        NET_API_STATUS nStatus;
-       DWORD dwTotalCount = 0;
        size_t retlen;
        wchar_t user[MAX_NAME_LENGTH];
 
@@ -97,7 +96,6 @@ isc_ntsecurity_getaccountgroups(char *username, char **GroupList,
                        dwEntriesRead = 0;
        }
 
-       dwTotalCount = 0;
        if (pBuf != NULL) {
                pTmpLBuf = pBuf;
                /*
index bbd5f1d6c190dfdab30563df3e2b4e4aa931cae5..6aea7809563bc5b2a71b4353625c17352b30264f 100644 (file)
@@ -35,7 +35,7 @@ initialize_action(void) {
 
 unsigned int
 isc_os_ncpus(void) {
-       long ncpus = 1;
+       long ncpus;
        initialize_action();
        ncpus = SystemInfo.dwNumberOfProcessors;
        if (ncpus <= 0)
index c2693977f0980f5a0029a7d62c6ac8884cfbf074..f015974c596a4475e8cb1ec19758ab9ecd43501e 100644 (file)
@@ -718,7 +718,6 @@ static void
 queue_receive_request(isc_socket_t *sock) {
        DWORD Flags = 0;
        DWORD NumBytes = 0;
-       int total_bytes = 0;
        int Result;
        int Error;
        int need_retry;
@@ -1096,9 +1095,8 @@ dump_msg(struct msghdr *msg, isc_socket_t *sock) {
        printf("\tname %p, namelen %d\n", msg->msg_name, msg->msg_namelen);
        printf("\tiov %p, iovlen %d\n", msg->msg_iov, msg->msg_iovlen);
        for (i = 0; i < (unsigned int)msg->msg_iovlen; i++)
-               printf("\t\t%d\tbase %p, len %d\n", i,
-                      msg->msg_iov[i].buf,
-                      msg->msg_iov[i].len);
+               printf("\t\t%u\tbase %p, len %u\n", i,
+                      msg->msg_iov[i].buf, msg->msg_iov[i].len);
 }
 #endif
 
@@ -1609,21 +1607,21 @@ free_socket(isc_socket_t **sockp, int lineno) {
        isc_socket_t *sock = *sockp;
        *sockp = NULL;
 
-       manager = sock->manager;
-
        /*
         * Seems we can free the socket after all.
         */
        manager = sock->manager;
-       socket_log(__LINE__, sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET,
-                  ISC_MSG_DESTROYING, "freeing socket line %d fd %d lock %p semaphore %p",
+       socket_log(__LINE__, sock, NULL, CREATION, isc_msgcat,
+                  ISC_MSGSET_SOCKET, ISC_MSG_DESTROYING,
+                  "freeing socket line %d fd %d lock %p semaphore %p",
                   lineno, sock->fd, &sock->lock, sock->lock.LockSemaphore);
 
        sock->magic = 0;
        DESTROYLOCK(&sock->lock);
 
        if (sock->recvbuf.base != NULL)
-               isc_mem_put(manager->mctx, sock->recvbuf.base, sock->recvbuf.len);
+               isc_mem_put(manager->mctx, sock->recvbuf.base,
+                           sock->recvbuf.len);
 
        LOCK(&manager->lock);
        if (ISC_LINK_LINKED(sock, link))
@@ -1880,7 +1878,6 @@ isc__socket_attach(isc_socket_t *sock, isc_socket_t **socketp) {
 void
 isc__socket_detach(isc_socket_t **socketp) {
        isc_socket_t *sock;
-       isc_boolean_t kill_socket = ISC_FALSE;
 
        REQUIRE(socketp != NULL);
        sock = *socketp;
@@ -2779,10 +2776,7 @@ static isc_result_t
 socket_recv(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
            unsigned int flags)
 {
-       int cc = 0;
-       isc_task_t *ntask = NULL;
        isc_result_t result = ISC_R_SUCCESS;
-       int recv_errno = 0;
 
        dev->ev_sender = task;
 
index 56498d0ade10ed4c64e432bc1afdac347b2b5385..1a1b593855272cea717c3e23d265b7f396608885 100644 (file)
@@ -44,7 +44,7 @@ initialize_action(void) {
         */
        if(!bSuccess) {
                osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-               bSuccess = GetVersionEx((OSVERSIONINFO *) &osVer);
+               (void)GetVersionEx((OSVERSIONINFO *) &osVer);
        }
        bInit = TRUE;
 }
@@ -98,4 +98,4 @@ isc_win32os_versioncheck(unsigned int major, unsigned int minor,
 
        /* Exact */
        return (0);
-}
\ No newline at end of file
+}
index c6fb6331e444a7de11c4f42dac30e2b75f5f35ad..1436974519ff51661220802b6d9b8e8bb9c3f8e6 100644 (file)
@@ -70,6 +70,10 @@ get_win32_searchlist(lwres_context_t *ctx) {
        }
 
        confdata->searchnxt = 0;
+
+       if (!keyFound)
+               return;
+
        cp = strtok((char *)searchlist, ", \0");
        while (cp != NULL) {
                if (confdata->searchnxt == LWRES_CONFMAXSEARCH)
@@ -85,8 +89,7 @@ get_win32_searchlist(lwres_context_t *ctx) {
 
 lwres_result_t
 lwres_conf_parse(lwres_context_t *ctx, const char *filename) {
-       lwres_result_t ret = LWRES_R_SUCCESS;
-       lwres_result_t res;
+       lwres_result_t ret;
        lwres_conf_t *confdata;
        FIXED_INFO * FixedInfo;
        ULONG    BufLen = sizeof(FIXED_INFO);
@@ -137,11 +140,11 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) {
                if (confdata->nsnext >= LWRES_CONFMAXNAMESERVERS)
                        break;
 
-               res = lwres_create_addr(pIPAddr->IpAddress.String,
+               ret = lwres_create_addr(pIPAddr->IpAddress.String,
                                &confdata->nameservers[confdata->nsnext++], 1);
-               if (res != LWRES_R_SUCCESS) {
+               if (ret != LWRES_R_SUCCESS) {
                        GlobalFree(FixedInfo);
-                       return (res);
+                       return (ret);
                }
                pIPAddr = pIPAddr ->Next;
        }