gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: do not crash if psql is interrupted with


From: gnunet
Subject: [gnunet] branch master updated: do not crash if psql is interrupted with CTRL-C
Date: Thu, 21 Jul 2022 12:31:49 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 63802d724 do not crash if psql is interrupted with CTRL-C
63802d724 is described below

commit 63802d7241f06d04096d84bcd4dc49d7449293d8
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Thu Jul 21 12:30:22 2022 +0200

    do not crash if psql is interrupted with CTRL-C
---
 src/pq/pq_connect.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c
index 5fea994ef..a8c552407 100644
--- a/src/pq/pq_connect.c
+++ b/src/pq/pq_connect.c
@@ -150,6 +150,7 @@ apply_patch (struct GNUNET_PQ_Context *db,
   unsigned long code;
   size_t slen = strlen (load_path) + 10;
   char buf[slen];
+  enum GNUNET_GenericReturnValue ret;
 
   GNUNET_snprintf (buf,
                    sizeof (buf),
@@ -180,10 +181,21 @@ apply_patch (struct GNUNET_PQ_Context *db,
                               "psql");
     return GNUNET_SYSERR;
   }
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_OS_process_wait_status (psql,
-                                                &type,
-                                                &code));
+  ret = GNUNET_OS_process_wait_status (psql,
+                                       &type,
+                                       &code);
+  if (GNUNET_OK != ret)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "psql on file %s did not finish, killed it!\n",
+                buf);
+    /* can happen if we got a signal, like CTRL-C, before
+       psql was complete */
+    (void) GNUNET_OS_process_kill (psql,
+                                   SIGKILL);
+    GNUNET_OS_process_destroy (psql);
+    return GNUNET_SYSERR;
+  }
   GNUNET_OS_process_destroy (psql);
   if ( (GNUNET_OS_PROCESS_EXITED != type) ||
        (0 != code) )

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]