Skip to content
  • Raphael Kubo da Costa's avatar
    libarchive: Stop manually handling temporary work files. · de3cc8dc
    Raphael Kubo da Costa authored
    Having to call QFile::remove() whenever there is a failure and we want
    to get rid of the working file is bad -- for example, we were not
    calling it when archive_write_header() failed in deleteFiles() and thus
    could end up with a potentially big dangling file.
    
    By using KSaveFile, we solve that problem and also stop using
    predictable names for the temporary files we work on when adding and
    deleting entries.
    
    Note that we use KSaveFile with Qt5's QSaveFile semantics: instead of
    calling finalize() by default, we take the safer approach of calling
    abort() instead. This is done by wrapping KSaveFile in a QScopedPointer
    and calling abort() in the custom deleter. We then explicitly call
    finalize() when we want to.
    de3cc8dc