Commit bbb3705e authored by Mark Andrews's avatar Mark Andrews
Browse files

3535. [bug] Minor win32 cleanups. [RT #32962]

parent 80f1365a
3535. [bug] Minor win32 cleanups. [RT #32962]
3534. [bug] Extra text after an embedded NULL was ignored when
parsing zone files. [RT #32699]
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
/*
......
......@@ -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)
......
......@@ -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;
......
......@@ -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
}
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment