mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2025-01-31 03:10:33 +00:00
Cleanup in failures a little better.
This commit is contained in:
parent
86e71b11eb
commit
b892bcfdbc
1 changed files with 19 additions and 17 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue