#5 Bug and fix for queued

closed-fixed
None
5
2000-11-03
2000-11-01
No

Short:
Uncaught read of zero length files with subsequent call of gethostbyname() produced error messages.

Description:
Set up new queue (named seti) to make acquaintance with GNU queue. Apparantly, this left some zero length files) in the CFDIR of the queue.

-rw------- 1 root 0 Nov 1 17:05 cfm537130463
-rw------- 1 root 0 Nov 1 17:06 cfm537130671
-rw------- 1 root 0 Nov 1 17:17 cfm537141410

Now, calls to a non existing queue (for example bla)
>queue -d bla -- hostname
produced this error (in the window that started the queued):
gethostbyname on џОнt returned error.
gethostbyname on џОнt returned error.

Fix:
--- queue-1.20.2/queued.c Sun Sep 10 02:14:22 2000
+++ queued.c Wed Nov 1 19:20:15 2000
@@ -2144,6 +2144,12 @@
return NULL;
}

+ if(sbuf.st_size==0){
+ mperror1("file %s has 0 length", filename);
+ fprintf(stderr, "%s/%s has 0 length", filename);
+ return NULL;
+ }
+
jp->j_seen = 1; /* we've seen this job */
jp->j_queue_b = qp; /* back pointer to queue_b */
/*2000/7/19 WGK Draft protocol changes. First thing in job control file is version

Discussion

  • Bastien Chevreux

    I'd strongly suggest to add

    (void) fclose(f);

    into the if-clause (as well as into some other clauses, so that the new diff now looks like this:

    --- queue-1.20.2/queued.c Sun Sep 10 02:14:22 2000
    +++ queued.c Thu Nov 2 10:08:19 2000
    @@ -2141,6 +2141,14 @@

    if( fstat(fileno(f), &sbuf) < 0 ){
    mperror1("Can't fstat(%s)", filename);
    + (void) fclose(f);
    + return NULL;
    + }
    +
    + if(sbuf.st_size==0){
    + mperror1("file %s has 0 length", filename);
    + (void) fclose(f);
    + fprintf(stderr, "%s/%s has 0 length", filename);
    return NULL;
    }

    @@ -2172,6 +2180,7 @@
    netfread(&(jp->j_mailflag), sizeof(int), 1, f); /* local uid running job */

    if( ferror(f) ){
    + (void) fclose(f);
    mperror1("Error reading '%s'", filename);
    return NULL;
    }

     
  • Werner G Krebs

    Werner G Krebs - 2000-11-02
    • assigned_to: nobody --> wkrebs
    • status: open --> open-fixed
     
  • Werner G Krebs

    Werner G Krebs - 2000-11-02

    Added patch to patch DB.

    Will add to CVS for 1.30 shortly; should be in next release.

     
  • Werner G Krebs

    Werner G Krebs - 2000-11-03

    Fixed. Added to queued.c in CVS repository.

     
  • Werner G Krebs

    Werner G Krebs - 2000-11-03
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks