Results 1 to 1 of 1

Thread: Restore.c bug fixes / cleanup patches.

  1. #1

    Default Restore.c bug fixes / cleanup patches.

    I've created two patches which simplifies the restore pipeline code,
    corrects some ancient memory management problems, and corrects
    the library functions restore() and read_file_header() to return
    the results of the last read via the function return value rather than
    the global variable 'bytes_read'.

    Specifically the two patches which fix the following problems:
    restore.patch:
    Hanging/failing restores:
    1) Hangs forever with writer waiting for room in the pipe
    and reader waiting for data...
    2) Fails with the following message:
    amrecover: writer data fd read error: Connection reset by peer
    tar: Read 4096 bytes from -
    tar: Unexpected EOF in archive
    tar: Unexpected EOF in archive
    tar: Error is not recoverable: exiting now
    extract_list - child returned non-zero status: 1

    Memory management problems:
    1) append_file_to_fd()
    * Allocates a buffer using an unchecked global value for size.
    * Does not free memory at end of routine.

    2) get_block()
    * Allocates memory for read buffer using local variable for
    pointer. Then expects calling routine to find memory...
    * Checks memory allocation size *after* memory allocation.
    * Checks for necessity to reallocate buffer using a bogus
    (always false) check and then does nothing inside if statement.
    3) read_file_header()
    * Allocates buffer twice...
    * Does not free buffer before second allocation.
    4) drain_file()
    * Allocates a buffer using an unchecked global value for size.
    5) restore()
    * Allocates a buffer using an unchecked global value for size.
    * Allocates/frees buffer inside of read loop.

    bytes_read.patch:
    Problem returning read results in a global variable (bytes_read) from
    within the restore library and externally via restore() and
    read_file_header().

    The two patches must be applied in the following order:
    1) restore.patch
    2) read_bytes.patch
    Attached Files Attached Files
    Last edited by John Franks; December 16th, 2005 at 03:42 PM. Reason: Adding attachements

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •