Index: /trunk/include/VBox/VBoxGuestLib.h
===================================================================
--- /trunk/include/VBox/VBoxGuestLib.h	(revision 53420)
+++ /trunk/include/VBox/VBoxGuestLib.h	(revision 53421)
@@ -432,5 +432,5 @@
 VBGLR3DECL(int)     VbglR3WriteLog(const char *pch, size_t cch);
 VBGLR3DECL(int)     VbglR3CtlFilterMask(uint32_t fOr, uint32_t fNot);
-VBGLR3DECL(int)     VbglR3Daemonize(bool fNoChDir, bool fNoClose);
+VBGLR3DECL(int)     VbglR3Daemonize(bool fNoChDir, bool fNoClose, bool fRespawn);
 VBGLR3DECL(int)     VbglR3PidFile(const char *pszPath, PRTFILE phFile);
 VBGLR3DECL(void)    VbglR3ClosePidFile(const char *pszPath, RTFILE hFile);
Index: /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDaemonize.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDaemonize.cpp	(revision 53420)
+++ /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDaemonize.cpp	(revision 53421)
@@ -43,4 +43,5 @@
 # include <sys/types.h>
 # include <sys/stat.h>
+# include <sys/wait.h>
 # include <stdio.h>
 # include <fcntl.h>
@@ -66,8 +67,13 @@
  * @param   fNoChDir    Pass false to change working directory to root.
  * @param   fNoClose    Pass false to redirect standard file streams to /dev/null.
+ * @param   fRespawn    Restart the daemonised process after five seconds if it
+ *                      terminates abnormally.
  *
  * @todo    Use RTProcDaemonize instead of this.
- */
-VBGLR3DECL(int) VbglR3Daemonize(bool fNoChDir, bool fNoClose)
+ * @todo    Implement fRespawn on OS/2.
+ * @todo    Make the respawn interval configurable.  But not until someone
+ *          actually needs that.
+ */
+VBGLR3DECL(int) VbglR3Daemonize(bool fNoChDir, bool fNoClose, bool fRespawn)
 {
 #if defined(RT_OS_OS2)
@@ -76,4 +82,5 @@
     DosGetInfoBlocks(&pTib, &pPib);
 
+    AssertRelease(!fRespawn);
     /* Get the full path to the executable. */
     char szExe[CCHMAXPATH];
@@ -211,4 +218,26 @@
 # endif /* RT_OS_LINUX */
 
+    if (fRespawn)
+        /* We implement re-spawning as a third fork(), with the parent process
+         * monitoring the child and re-starting it after a delay if it exits
+         * abnormally. */
+        for (;;)
+        {
+            int iStatus, rcWait;
+
+            pid = fork();
+            if (pid == -1)
+                return RTErrConvertFromErrno(errno);
+            if (pid == 0)
+                return VINF_SUCCESS;
+            do
+                rcWait = waitpid(pid, &iStatus, 0);
+            while (rcWait == -1 && errno == EINTR);
+            if (rcWait == -1)
+                exit(1);
+            if (WIFEXITED(iStatus) && WEXITSTATUS(iStatus) == 0)
+                exit(0);
+            sleep(5);
+        }
     return VINF_SUCCESS;
 #endif
Index: /trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp	(revision 53420)
+++ /trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp	(revision 53421)
@@ -1098,5 +1098,6 @@
 #else
         VBoxServiceVerbose(1, "Daemonizing...\n");
-        rc = VbglR3Daemonize(false /* fNoChDir */, false /* fNoClose */);
+        rc = VbglR3Daemonize(false /* fNoChDir */, false /* fNoClose */,
+                             false /* fRespawn */);
         if (RT_FAILURE(rc))
             return VBoxServiceError("Daemon failed: %Rrc\n", rc);
Index: /trunk/src/VBox/Additions/x11/VBoxClient/main.cpp
===================================================================
--- /trunk/src/VBox/Additions/x11/VBoxClient/main.cpp	(revision 53420)
+++ /trunk/src/VBox/Additions/x11/VBoxClient/main.cpp	(revision 53421)
@@ -271,5 +271,5 @@
 int main(int argc, char *argv[])
 {
-    bool fDaemonise = true;
+    bool fDaemonise = true, fRespawn = true;
     int rc;
     const char *pcszFileName, *pcszStage;
@@ -311,4 +311,8 @@
             fDaemonise = false;
         }
+        else if (!strcmp(argv[i], "--no-respawn"))
+        {
+            fRespawn = false;
+        }
         else if (!strcmp(argv[i], "--clipboard"))
         {
@@ -373,5 +377,5 @@
         VBClFatalError(("Creating pid-file path: %Rrc\n", rc));
     if (fDaemonise)
-        rc = VbglR3Daemonize(false /* fNoChDir */, false /* fNoClose */);
+        rc = VbglR3Daemonize(false /* fNoChDir */, false /* fNoClose */, fRespawn);
     if (RT_FAILURE(rc))
         VBClFatalError(("Daemonizing: %Rrc\n", rc));
