Don't cast the return from realloc()
[openafs.git] / src / libadmin / bos / afs_bosAdmin.c
index 44be450..95cde20 100644 (file)
@@ -9,30 +9,21 @@
 
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <afs/stds.h>
 
+#include <roken.h>
 
-#include <stdio.h>
-#include <afs/stds.h>
 #include <rx/rx.h>
 #include <rx/rxstat.h>
-#include "afs_bosAdmin.h"
-#include "../adminutil/afs_AdminInternal.h"
 #include <afs/afs_AdminErrors.h>
 #include <afs/afs_utilAdmin.h>
 #include <afs/bosint.h>
 #include <afs/bnode.h>
 #include <afs/ktime.h>
 #include <afs/dirpath.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#ifdef AFS_NT40_ENV
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-#include <string.h>
+
+#include "afs_bosAdmin.h"
+#include "../adminutil/afs_AdminInternal.h"
 
 typedef struct bos_server {
     int begin_magic;
@@ -1941,7 +1932,7 @@ bos_KeyCreate(const void *serverHandle, int keyVersionNumber,
        goto fail_bos_KeyCreate;
     }
 
-    tst = BOZO_AddKey(b_handle->server_encrypt, keyVersionNumber, key);
+    tst = BOZO_AddKey(b_handle->server_encrypt, keyVersionNumber, kas_to_bozoptr(key));
 
     if (tst == 0) {
        rc = 1;
@@ -2020,7 +2011,7 @@ GetKeyRPC(void *rpc_specific, int slot, int *last_item,
 
     tst =
        BOZO_ListKeys(key->server, key->next++,
-                     &key->key[slot].keyVersionNumber, &key->key[slot].key,
+                     &key->key[slot].keyVersionNumber, kas_to_bozoptr(&key->key[slot].key),
                      &keyInfo);
 
 
@@ -2714,7 +2705,7 @@ bos_ExecutableCreate(const void *serverHandle, const char *sourceFile,
 
     while (1) {
        char tbuffer[512];
-       size_t len;
+       ssize_t len;
        len = read(fd, tbuffer, sizeof(tbuffer));
        if (len < 0) {
            tst = ADMBOSCANTREADSOURCEFILE;
@@ -2824,8 +2815,8 @@ bos_ExecutableRevert(const void *serverHandle, const char *execFile,
 
 int ADMINAPI
 bos_ExecutableTimestampGet(const void *serverHandle, const char *execFile,
-                          unsigned long *newTime, unsigned long *oldTime,
-                          unsigned long *bakTime, afs_status_p st)
+                          afs_int32 *newTime, afs_int32 *oldTime,
+                          afs_int32 *bakTime, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
@@ -2964,7 +2955,7 @@ bos_ExecutableRestartTimeSet(const void *serverHandle, bos_Restart_t type,
     afs_status_t tst = 0;
     bos_server_p b_handle = (bos_server_p) serverHandle;
     afs_int32 restartType = 0;
-    struct ktime restartTime;
+    struct bozo_netKTime restartTime;
 
     if (!isValidServerHandle(b_handle, &tst)) {
        goto fail_bos_ExecutableRestartTimeSet;
@@ -3050,7 +3041,7 @@ bos_ExecutableRestartTimeGet(const void *serverHandle, bos_Restart_t type,
     afs_status_t tst = 0;
     bos_server_p b_handle = (bos_server_p) serverHandle;
     afs_int32 restartType = 0;
-    struct ktime restartTime;
+    struct bozo_netKTime restartTime;
 
     if (!isValidServerHandle(b_handle, &tst)) {
        goto fail_bos_ExecutableRestartTimeGet;
@@ -3154,7 +3145,7 @@ bos_LogGet(const void *serverHandle, const char *log,
 
     tcall = rx_NewCall(b_handle->server);
     have_call = 1;
-    tst = StartBOZO_GetLog(tcall, log);
+    tst = StartBOZO_GetLog(tcall, (char *) log);
 
     if (tst != 0) {
        goto fail_bos_LogGet;
@@ -3295,7 +3286,7 @@ bos_CommandExecute(const void *serverHandle, const char *command,
        goto fail_bos_CommandExecute;
     }
 
-    tst = BOZO_Exec(b_handle->server, command);
+    tst = BOZO_Exec(b_handle->server, (char *) command);
 
     if (tst == 0) {
        rc = 1;
@@ -3542,7 +3533,7 @@ bos_Salvage(const void *cellHandle, const void *serverHandle,
               (serverHandle, AFSDIR_CANONICAL_SERVER_SLVGLOG_FILEPATH,
                &logLen, logData, &tst)) {
            if (logLen > INITIAL_LOG_LEN) {
-               logData = (char *)realloc(logData, (logLen + (logLen / 10)));
+               logData = realloc(logData, (logLen + (logLen / 10)));
                if (logData == NULL) {
                    tst = ADMNOMEM;
                    goto fail_bos_Salvage;