Treat bad records as EOF.
authorAlan T. DeKok <aland@freeradius.org>
Tue, 4 May 2010 09:30:50 +0000 (11:30 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 4 May 2010 10:15:32 +0000 (12:15 +0200)
This helps when the disk is full, and rlm_detail writes a partial record.

src/modules/frs_detail/frs_detail.c

index 921dc31..5bd42a7 100644 (file)
@@ -731,7 +731,16 @@ int detail_recv(rad_listen_t *listener,
  alloc_packet:
        data->tries++;
        
-       rad_assert(data->state == STATE_QUEUED);
+       /*
+        *      The writer doesn't check that the record was
+        *      completely written.  If the disk is full, this can
+        *      result in a truncated record.  When that happens,
+        *      treat it as EOF.
+        */
+       if (data->state != STATE_QUEUED) {
+               radlog(L_ERR, "Truncated record: treating it as EOF for detail file %s", data->filename_work);
+               goto cleanup;     
+       }
 
        /*
         *      We're done reading the file, but we didn't read