glite_jppsbe_query(): return ENOENT rather then EIO when nothing is found
authorAleš Křenek <ljocha@ics.muni.cz>
Tue, 14 Mar 2006 13:19:31 +0000 (13:19 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Tue, 14 Mar 2006 13:19:31 +0000 (13:19 +0000)
org.glite.jp.primary/src/new_ftp_backend.c

index 75210ca..fe1dd2e 100644 (file)
@@ -1874,12 +1874,18 @@ int glite_jppsbe_query(
                        where,
                        cmask & 1 ? "and u.userid = j.owner" : "");
 
-       if (glite_jp_db_execstmt(ctx,stmt,&q) <= 0) {
+       if ((ret = glite_jp_db_execstmt(ctx,stmt,&q)) < 0) {
                err.code = EIO;
                err.desc = "DB call fail";
                glite_jp_stack_error(ctx,&err);
                goto cleanup;
        }
+       else if (ret == 0) {
+               err.code = ENOENT;
+               err.desc = "no matching jobs";
+               glite_jp_stack_error(ctx,&err);
+               goto cleanup;
+       }
 
        while ((ret = glite_jp_db_fetchrow(q,qres)) > 0) {
                if (cmask & 1) {