Correct some redundant if() clauses
[openafs.git] / src / libadmin / client / afs_clientAdmin.c
index 38e864d..aa49358 100644 (file)
@@ -9,36 +9,23 @@
 
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <afs/stds.h>
 
+#include <roken.h>
 
-#include <afs/stds.h>
-#include "afs_clientAdmin.h"
-#include "../adminutil/afs_AdminInternal.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <afs/cellconfig.h>
 #ifdef AFS_NT40_ENV
 #include <afs/afssyscalls.h>
-#include <winsock2.h>
 #include <afs/fs_utils.h>
 #define close(x) closesocket(x)
 #else
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
 #include <afs/venus.h>
-#include <errno.h>
-#include <strings.h>
-#include <unistd.h>
 #endif
-#include <string.h>
-#include <afs/kautils.h>
 #include <rx/rx.h>
 #include <rx/rxstat.h>
 #include <rx/rx_null.h>
 #include <rx/rxkad.h>
+
+#include <afs/kautils.h>
 #include <afs/dirpath.h>
 #include <afs/afs_AdminErrors.h>
 #include <afs/afs_vosAdmin.h>
 #include <afs/ptserver.h>
 #include <afs/vlserver.h>
 #include <afs/pthread_glock.h>
+#include <afs/sys_prototypes.h>
+
+#include "afs_clientAdmin.h"
+#include "../adminutil/afs_AdminInternal.h"
 
 /*
  * AFS client administration functions.
@@ -214,7 +205,7 @@ afsclient_TokenGetExisting(const char *cellName, void **tokenHandle,
                                          t_handle->afs_token.ticketLen,
                                          t_handle->afs_token.ticket);
        if ((t_handle->afs_sc[t_handle->sc_index] == NULL)
-           || (t_handle->afs_sc[t_handle->sc_index] == NULL)) {
+           || (t_handle->afs_encrypt_sc[t_handle->sc_index] == NULL)) {
            tst = ADMCLIENTTOKENHANDLENOSECURITY;
            goto fail_afsclient_TokenGetExisting;
        } else {
@@ -1236,7 +1227,7 @@ client_ExtractDriveLetter(char *path)
 static int
 Parent(char *directory, char *parentDirectory)
 {
-    register char *tp;
+    char *tp;
     int rc = 0;
 
     strcpy(parentDirectory, directory);
@@ -1366,7 +1357,8 @@ afsclient_MountPointCreate(const void *cellHandle, const char *directory,
      */
 
     if (volCheck == CHECK_VOLUME) {
-       if (!vos_VLDBGet(cellHandle, 0, 0, volumeName, &vldbEntry, &tst)) {
+       if (!vos_VLDBGet(cellHandle, 0, 0, (char *)volumeName, &vldbEntry,
+                        &tst)) {
            goto fail_afsclient_MountPointCreate;
        }
     }
@@ -1498,7 +1490,7 @@ afsclient_ACLEntryAdd(const char *directory, const char *user,
     idata.out_size = 2048;
     idata.in_size = 0;
     idata.in = idata.out = old_acl_string;
-    tst = pioctl(directory, VIOCGETAL, &idata, 1);
+    tst = pioctl((char *)directory, VIOCGETAL, &idata, 1);
 
     if (tst != 0) {
        goto fail_afsclient_ACLEntryAdd;
@@ -1540,7 +1532,7 @@ afsclient_ACLEntryAdd(const char *directory, const char *user,
      */
 
     is_dfs =
-       sscanf(old_acl_string, "%d dfs:%d %s", &cur_acl.nplus, &cur_acl.dfs,
+       sscanf(old_acl_string, "%d dfs:%d %1024s", &cur_acl.nplus, &cur_acl.dfs,
               cur_acl.cell);
     ptr = strchr(old_acl_string, '\n');
     ptr++;
@@ -1565,7 +1557,7 @@ afsclient_ACLEntryAdd(const char *directory, const char *user,
      */
 
     for (i = 0; i < (cur_acl.nplus + cur_acl.nminus); i++) {
-       sscanf(ptr, "%s%d\n", cur_user, &cur_user_acl);
+       sscanf(ptr, "%63s%d\n", cur_user, &cur_user_acl);
        /*
         * Skip the entry for the user we are replacing/adding
         */
@@ -1587,7 +1579,7 @@ afsclient_ACLEntryAdd(const char *directory, const char *user,
     idata.out_size = 0;
     idata.in_size = strlen(new_acl_string) + 1;
     idata.in = idata.out = new_acl_string;
-    tst = pioctl(directory, VIOCSETAL, &idata, 1);
+    tst = pioctl((char *) directory, VIOCSETAL, &idata, 1);
 
     if (tst != 0) {
        goto fail_afsclient_ACLEntryAdd;
@@ -1830,9 +1822,8 @@ afsclient_AFSServerGetBegin(const void *cellHandle, void **iterationIdP,
     int rc = 0;
     afs_status_t tst = 0;
     afs_cell_handle_p c_handle = (afs_cell_handle_p) cellHandle;
-    afs_admin_iterator_p iter =
-       (afs_admin_iterator_p) malloc(sizeof(afs_admin_iterator_t));
-    server_get_p serv = (server_get_p) calloc(1, sizeof(server_get_t));
+    afs_admin_iterator_p iter = malloc(sizeof(afs_admin_iterator_t));
+    server_get_p serv = calloc(1, sizeof(server_get_t));
     server_get_p serv_cache = NULL;
     const char *cellName = NULL;
     void *database_iter;
@@ -2662,7 +2653,7 @@ afsclient_RXDebugOpen(const char *serverName, afs_stat_source_t type,
        goto fail_afsclient_RXDebugOpen;
     }
 
-    handle = (rxdebugHandle_p) malloc(sizeof(rxdebugHandle_t));
+    handle = malloc(sizeof(rxdebugHandle_t));
     if (!handle) {
        close(sock);
        tst = ADMNOMEM;
@@ -2747,7 +2738,7 @@ afsclient_RXDebugOpenPort(const char *serverName, int serverPort,
        goto fail_afsclient_RXDebugOpenPort;
     }
 
-    handle = (rxdebugHandle_p) malloc(sizeof(rxdebugHandle_t));
+    handle = malloc(sizeof(rxdebugHandle_t));
     if (!handle) {
        close(sock);
        tst = ADMNOMEM;