]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
General code clean-up.
authorOliver Kurth <okurth@vmware.com>
Tue, 18 Dec 2018 21:19:48 +0000 (13:19 -0800)
committerOliver Kurth <okurth@vmware.com>
Tue, 18 Dec 2018 21:19:48 +0000 (13:19 -0800)
bora/lib/misc/posixPosix.c:
Treat local variables "len" consistently as "size_t" type in
Posix_Getmntent_r()

bora-vmsoft/apps/toolbox-cmd/toolboxcmd-shrink.c:
Improve readability of error handling logic in ShrinkDoWipeAndShrink()
and remove another line of dead code.

open-vm-tools/lib/misc/posixPosix.c
open-vm-tools/toolbox/toolboxcmd-shrink.c

index 2c1c278e7b36ede2ba1febff9e6e6322a1cf7a73..7e0d5da5ece4a8f295240c82521b9806443afdd6 100644 (file)
@@ -2075,7 +2075,7 @@ Posix_Getmntent_r(FILE *fp,          // IN:
    n = 0;
 
    if (fsname) {
-      int len = strlen(fsname) + 1;
+      size_t len = strlen(fsname) + 1;
 
       if (n + len > size || n + len < n) {
          goto exit;
@@ -2085,7 +2085,7 @@ Posix_Getmntent_r(FILE *fp,          // IN:
    }
 
    if (dir != NULL) {
-      int len = strlen(dir) + 1;
+      size_t len = strlen(dir) + 1;
 
       if (n + len > size || n + len < n) {
          goto exit;
@@ -2095,7 +2095,7 @@ Posix_Getmntent_r(FILE *fp,          // IN:
    }
 
    if (type) {
-      int len = strlen(type) + 1;
+      size_t len = strlen(type) + 1;
 
       if (n + len > size || n + len < n) {
          goto exit;
@@ -2128,7 +2128,7 @@ exit:
    }
 
    return m;
-#endif // defined __ANDROID__
+#endif // NO_GETMNTENT_R
 }
 
 
index 39c0a923cc6baadadb4b48d2ccae5cd8edacb61f..70ff4704964129604f71be92081157a6884372fc 100644 (file)
@@ -443,6 +443,7 @@ ShrinkDoWipeAndShrink(char *mountPoint,         // IN: mount point
          } else {
             ToolsCmd_PrintErr(SU_(error.message, "Error: %s\n"), err);
          }
+         /* progress < 100 will result in "rc" of EX_TEMPFAIL */
          break;
       }
 
@@ -464,14 +465,14 @@ ShrinkDoWipeAndShrink(char *mountPoint,         // IN: mount point
    }
 #endif
 
-   rc = EXIT_SUCCESS;
    g_print("\n");
-   if (progress >= 100 && performShrink) {
-      rc = ShrinkDiskSendRPC();
-   } else if (progress < 100) {
+   if (progress < 100) {
       rc = EX_TEMPFAIL;
+   } else if (performShrink) {
+      rc = ShrinkDiskSendRPC();
    } else {
-      g_debug("Shrinking skipped.\n");
+      rc = EXIT_SUCCESS;
+      g_debug("Shrink skipped.\n");
    }
 
    if (rc != EXIT_SUCCESS) {