fixed error logging while creating shards
authorJeroen van der Heijden <jeroen@transceptor.technology>
Wed, 26 Feb 2020 13:28:53 +0000 (14:28 +0100)
committerJeroen van der Heijden <jeroen@transceptor.technology>
Wed, 26 Feb 2020 13:28:53 +0000 (14:28 +0100)
include/siri/version.h
src/siri/db/shard.c

index 3d1e4e8b611cf28f11dc04c8f42abd600ee37986..808a7179b17bae29cc0bd8c678a631e260e581f9 100644 (file)
@@ -6,7 +6,7 @@
 
 #define SIRIDB_VERSION_MAJOR 2
 #define SIRIDB_VERSION_MINOR 0
-#define SIRIDB_VERSION_PATCH 35
+#define SIRIDB_VERSION_PATCH 36
 
 /*
  * Use SIRIDB_VERSION_PRE_RELEASE for alpha release versions.
@@ -15,7 +15,7 @@
  * Note that debian alpha packages should use versions like this:
  *   2.0.34-0alpha0
  */
-#define SIRIDB_VERSION_PRE_RELEASE ""
+#define SIRIDB_VERSION_PRE_RELEASE "-alpha-0"
 
 #ifndef NDEBUG
 #define SIRIDB_VERSION_BUILD_RELEASE "+debug"
index fbb401a06a8f438a159f6e3aa944ea9844a27668..c0669f9605c313140a31d6128aca303912468d06 100644 (file)
@@ -320,8 +320,8 @@ siridb_shard_t *  siridb_shard_create(
     FILE * fp;
     if (SHARD_init_fn(siridb, shard) < 0)
     {
-        ERR_ALLOC
         siridb_shard_decref(shard);
+        ERR_ALLOC
         return NULL;
     }
 
@@ -334,9 +334,11 @@ siridb_shard_t *  siridb_shard_create(
 
     if ((fp = fopen(shard->fn, "w")) == NULL)
     {
-        ERR_FILE
+        char buf[1024];
+        log_critical("Cannot create shard file: '%s' (%s)",
+                shard->fn, strerror_r(errno, buf, 1024));
         siridb_shard_decref(shard);
-        log_critical("Cannot create shard file: '%s'", shard->fn);
+        ERR_FILE
         return NULL;
     }
 
@@ -356,18 +358,22 @@ siridb_shard_t *  siridb_shard_create(
             fputc(siridb->time->precision, fp) == EOF ||
             fputc(shard->flags, fp) == EOF)
     {
-        ERR_FILE
+        char buf[1024];
+        log_critical("Cannot write to shard file: '%s' (%s)",
+                shard->fn, strerror_r(errno, buf, 1024));
         fclose(fp);
         siridb_shard_decref(shard);
-        log_critical("Cannot write to shard file: '%s'", shard->fn);
+        ERR_FILE
         return NULL;
     }
 
     if (fclose(fp))
     {
-        ERR_FILE
+        char buf[1024];
+        log_critical("Cannot close shard file: '%s' (%s)",
+                shard->fn, strerror_r(errno, buf, 1024));
         siridb_shard_decref(shard);
-        log_critical("Cannot close shard file: '%s'", shard->fn);
+        ERR_FILE
         return NULL;
     }