]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Customization: Set log level to info, not error, for failed /sbin/telinit command
authorJohn Wolfe <jwolfe@vmware.com>
Fri, 22 Jan 2021 20:25:41 +0000 (12:25 -0800)
committerJohn Wolfe <jwolfe@vmware.com>
Fri, 22 Jan 2021 20:25:41 +0000 (12:25 -0800)
The error message of a failed /sbin/telinit command is confusing for
customers who might think customization failed.  On some Guest OSes,
the repeatedly executing /sbin/telinit command can fail while a reboot
is happening and the init daemon has been killed.
This change sets log level to info, not error, for failed /sbin/telinit
command.
Note: The first /sbin/telinit commmand failure will fail customization
with error 127; this is unchanged.

open-vm-tools/libDeployPkg/linuxDeployment.c

index d56526559230f95380df22d9d44d4090118d7ce3..e3d6c2dc3a8c2f0ffb85dc438b7412cec28386eb 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2006-2020 VMware, Inc. All rights reserved.
+ * Copyright (C) 2006-2021 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -1464,8 +1464,7 @@ Deploy(const char* packageName)
             }
             rebootCommandResult =
                ForkExecAndWaitCommand("/sbin/telinit 6", false);
-            isRebooting = (rebootCommandResult == 0) ?
-                          true : isRebooting;
+            isRebooting = (rebootCommandResult == 0) ? true : isRebooting;
             sleep(1);
          } while (rebootCommandResult == 0);
          if (!isRebooting) {
@@ -1722,6 +1721,8 @@ ForkExecAndWaitCommand(const char* command, bool ignoreStdErr)
    int i;
    char** args = GetFormattedCommandLine(command);
    Bool isPerlCommand = (strcmp(args[0], "/usr/bin/perl") == 0) ? true : false;
+   Bool isTelinitCommand =
+      (strcmp(args[0], "/sbin/telinit") == 0) ? true : false;
 
    sLog(log_debug, "Command to exec : '%s'.", args[0]);
    Process_Create(&hp, args, sLog);
@@ -1761,10 +1762,17 @@ ForkExecAndWaitCommand(const char* command, bool ignoreStdErr)
          }
       }
    } else {
-      sLog(log_error,
-           "Customization command failed with exitcode: %d, stderr: '%s'.",
-           retval,
-           Process_GetStderr(hp));
+      if (isTelinitCommand) {
+         sLog(log_info,
+              "Telinit command failed with exitcode: %d, stderr: '%s'.",
+              retval,
+              Process_GetStderr(hp));
+      } else {
+         sLog(log_error,
+              "Customization command failed with exitcode: %d, stderr: '%s'.",
+              retval,
+              Process_GetStderr(hp));
+      }
    }
 
    Process_Destroy(hp);