]> git.sur5r.net Git - bacula/bacula/commitdiff
Program currval retrieval somewhat more robust.
authorMarco van Wieringen <mvw@planets.elm.net>
Tue, 6 Apr 2010 20:43:09 +0000 (22:43 +0200)
committerMarco van Wieringen <mvw@planets.elm.net>
Fri, 9 Apr 2010 11:40:26 +0000 (13:40 +0200)
bacula/src/cats/ingres.c

index af3428b774d827baf4fb583d92f3ee46805d898c..b8a85ee5d5c8f94cfc3ff17308ed092db09c30d2 100755 (executable)
@@ -647,6 +647,7 @@ static int my_ingres_currval(B_DB *mdb, const char *table_name)
 
    char sequence[64];
    char query[256];
+   char *currval;
    INGresult *result;
    int id = 0;
 
@@ -666,7 +667,10 @@ static int my_ingres_currval(B_DB *mdb, const char *table_name)
 
    Dmsg0(500, "exec done");
 
-   id = atoi(INGgetvalue(result, 0, 0));
+   currval = INGgetvalue(result, 0, 0);
+   if (currval) {
+      id = atoi(currval);
+   }
 
 bail_out:
    INGclear(result);