propagate connection error
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 22 Nov 2007 13:01:26 +0000 (13:01 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 22 Nov 2007 13:01:26 +0000 (13:01 +0000)
org.glite.lbjp-common.db/src/db.c

index 6b29fc9..1c8e663 100644 (file)
@@ -938,10 +938,14 @@ static int db_connect(glite_lbu_DBContext ctx, const char *cs, MYSQL **mysql) {
         * working in update_notif(). 
         * Hope it does not break anything else */ 
        if (!db_handle.mysql_real_connect(*mysql,host,user,pw,db,0,NULL,CLIENT_FOUND_ROWS)) {
+               char *desc;
                free(buf);
                ret = MY_ERR(ctx);
+               desc = ctx->err.desc;
+               ctx->err.desc = NULL;
                glite_lbu_DBClose(ctx);
-               return ret;
+               ctx->err.desc = desc;
+               return ctx->err.code = ret;
        }
        free(buf);