[ioquake3] 61/136: Cleanup in failures a little better.
Simon McVittie
smcv at debian.org
Thu Jun 15 09:09:10 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository ioquake3.
commit b892bcfdbc02c9089e60ebce854cf3b384b62139
Author: Ryan C. Gordon <icculus at icculus.org>
Date: Tue May 30 18:02:48 2017 -0400
Cleanup in failures a little better.
---
code/autoupdater/autoupdater.c | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/code/autoupdater/autoupdater.c b/code/autoupdater/autoupdater.c
index 7e20d33..f2e0535 100644
--- a/code/autoupdater/autoupdater.c
+++ b/code/autoupdater/autoupdater.c
@@ -76,7 +76,7 @@ typedef struct ManifestItem
struct ManifestItem *next;
} ManifestItem;
-static ManifestItem *manifest;
+static ManifestItem *manifest = NULL;
static void freeManifest(void)
{
@@ -92,6 +92,22 @@ static void freeManifest(void)
manifest = NULL;
}
+static const char *timestamp(void)
+{
+ time_t t = time(NULL);
+ char *retval = asctime(localtime(&t));
+ if (retval) {
+ char *ptr;
+ for (ptr = retval; *ptr; ptr++) {
+ if ((*ptr == '\r') || (*ptr == '\n')) {
+ *ptr = '\0';
+ break;
+ }
+ }
+ }
+ return retval ? retval : "[date unknown]";
+}
+
static FILE *logfile = NULL;
@@ -140,8 +156,10 @@ static void die(const char *why) NEVER_RETURNS;
static void die(const char *why)
{
infof("FAILURE: %s", why);
+ curl_global_cleanup();
restoreRollbacks();
freeManifest();
+ infof("Updater ending (in failure), %s", timestamp());
exit(1);
}
@@ -628,22 +646,6 @@ static void deleteRollbacks(void)
}
}
-static const char *timestamp(void)
-{
- time_t t = time(NULL);
- char *retval = asctime(localtime(&t));
- if (retval) {
- char *ptr;
- for (ptr = retval; *ptr; ptr++) {
- if ((*ptr == '\r') || (*ptr == '\n')) {
- *ptr = '\0';
- break;
- }
- }
- }
- return retval ? retval : "[date unknown]";
-}
-
static void chdirToBasePath(const char *argv0)
{
const char *fname = justFilename(argv0);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git
More information about the Pkg-games-commits
mailing list