summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
Commit message (Collapse)AuthorAgeFilesLines
* cleanup headers and especially #includes everywhereDavid Kalnischkies2014-03-131-3/+9
| | | | | | | | Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use)
* warning: useless cast to type A [-Wuseless-cast]David Kalnischkies2014-03-131-2/+2
| | | | | Git-Dch: Ignore Reported-By: gcc -Wuseless-cast
* warning: cast from type A to type B casts away qualifiers [-Wcast-qual]David Kalnischkies2014-03-131-2/+2
| | | | | Git-Dch: Ignore Reported-By: gcc -Wcast-qual
* Fix typos in documentation (codespell)Michael Vogt2014-02-221-3/+3
|
* simplify code some more to make reddit happyDavid Kalnischkies2014-02-141-38/+29
| | | | | | | | | | | | | Commit 6008b79adf1d7ea5607fab87a355d664c8725026 should have been guarded by "Git-Dch: Ignore", but it wasn't and I only noticed it with the Close message via deity thinking "hehe, I wonder if someone is gonna notice". Looks like someone did: hats off to reddit user itisOmegakai! Good to know that what I do isn't only monitored by goverments. :) As there is another instance of basically the same code we just factor out the code a bit and reuse, so its even cleaner and not only simpler. Reported-By: scan-build
* simplify code to make compilers happyDavid Kalnischkies2014-02-101-3/+9
| | | | | | | | Does the same as before, but is a bit simpler on the logic for humans as well as compilers. scan-build complained about it at least with: "Result of operation is garbage or undefined" Reported-By: scan-build
* Merge remote-tracking branch 'donkult/debian/sid' into debian/sidMichael Vogt2014-01-261-1/+1
|\ | | | | | | | | | | | | Conflicts: apt-private/private-list.cc doc/po/de.po test/integration/framework
| * correct some style/performance/warnings from cppcheckDavid Kalnischkies2014-01-161-1/+1
| | | | | | | | | | | | | | | | The most "visible" change is from utime to utimensat/futimens as the first one isn't part of POSIX anymore. Reported-By: cppcheck Git-Dch: Ignore
* | Merge remote-tracking branch 'donkult/feature/clientmergepdiffs' into ↵Michael Vogt2014-01-051-1/+1
|\ \ | |/ |/| | | debian/experimental-no-abi-break
| * allow ':' in GetListOfFilesInDirDavid Kalnischkies2013-12-131-1/+1
| | | | | | | | | | | | | | run-parts doesn't allow this char in valid filenames, but we tend to have files with this character in e.g. /var/lib/apt/lists/ Git-Dch: Ignore
* | add basic tests for GetTempDir()Michael Vogt2013-12-231-1/+1
| |
* | factor GetTempDir outMichael Vogt2013-12-221-0/+17
|/
* truncating /dev/null to zero is always successfulDavid Kalnischkies2013-11-301-0/+3
| | | | | | | | | | | Calling truncate on /dev/null can happen by the download methods if they are instructed to download a file to /dev/null (as testcases are only interested in the status code, but do not support HEAD requests yet) So just ignore truncate calls on the /dev/null file as it is always empty anyway, so truncating to zero isn't a problem. Git-Dch: Ignore
* fix regression that APT::Keep-Fds is not honored (closes: #730490)Michael Vogt2013-11-281-8/+18
|
* small documentation updatesMichael Vogt2013-11-011-1/+2
|
* add new pid_t ExecFork(std::set<int> KeepFDs) to get rid of the super ugly ↵Michael Vogt2013-10-311-14/+19
| | | | APT::Keep-Fds hack and also add a new PackageManagerProgressFd::StartDpkg() progress state
* fix libapt-inst for >2G debs (closes: #725483)Michael Vogt2013-10-071-8/+8
|
* fix typo (mkostemp->mkstemp)Michael Vogt2013-08-311-1/+1
|
* use mkstemp instead of mkostemp in FileFd::Open()David Kalnischkies2013-08-271-8/+4
| | | | | | | | | | | | | | FileFd currently supports no fileflags which would make sense to provide via mkostemp, so we can just use mkstemp here which is a standard function compared to glib extension mkostemp. O_CREAT (Create) and O_TRUNC (Empty) are implied by O_EXCL, which is the mode mkstemp uses by default. The file description is opened ReadWrite, but that used to be the default for FileFd in the old times and not a problem as the difference is needed by FileFd to decide in which way the compressor pipeline needs to be created (if any). Git-Dch: Ignore
* replace usage of potential dangerous mktemp with mkstempAngel Guzman Maeso2013-08-271-5/+19
| | | | | | | | | | | | Avoid the warning "the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'". It is not strictly necessary to change the usage from a security point of view here, but mktemp is also removed from the standard since POSIX.1-2008. The mkostemp call returns a file descriptor the logic for TemporaryFileName has been changed accordingly to get the same results. The file permissions are corrected by using fchmod() as the default for FileFd is 666 while mkstemp creates files with 600 by default.
* apt-pkg:contrib Avoid compiler warning about sign-compareÁngel Guzmán Maeso2013-08-221-1/+2
| | | | | | | The fix avoid the warning "comparison between signed and unsigned integer expressions [-Wsign-compare]"· The index for the loop needs to be unsigned for compare with globbuf.gl_pathc structure member
* * lp:~mvo/apt/add-glob-function:Michael Vogt2013-08-151-0/+31
| | | | | | | - add Glob() to fileutl.{cc,h} Conflicts: apt-pkg/contrib/fileutl.h debian/changelog
* Merge remote-tracking branch 'mvo/bugfix/coverity' into debian/sidMichael Vogt2013-07-281-8/+9
|\
| * add missing "free(buffer) for allocated bufferMichael Vogt2013-07-251-1/+0
| |
| * fix resource leak (thanks coverity)Michael Vogt2013-07-251-4/+8
| |
| * always "delete d" in FileFd::~FileFd to coverity happyMichael Vogt2013-07-251-4/+2
| |
* | ensure that FileFd::Size returns 0 in error casesDavid Kalnischkies2013-07-261-5/+18
|/
* fail in CopyFile if the FileFds have error flag setDavid Kalnischkies2013-06-091-1/+2
| | | | | | | | | Testing for global PendingErrors in users of CopyFile is incorrect in so far as unrelated errors will prevent us from copying perfectly fine files and checking for the validity of the files is just better in CopyFiles as it already checks if files are at least opened. Add also a higher-level error message to the error stack if it fails.
* OpenDescriptor should autoclose fd always on errorDavid Kalnischkies2013-06-091-4/+19
| | | | | | | | | OpenInternDescriptor failures would cause additional errors to be generated by double-closing an fd. Other errors (although these are generated if the method is used incorrectly, so unlikely) didn't close the fd aswell. Closes: 704608
* set Fail flag in FileFd on all errors consistentlyDavid Kalnischkies2013-06-091-96/+71
| | | | | | Previously some errors would set the Fail flag while some didn't without a clear reason as all errors leave a bad FileFd behind, so we use a helper now to ensure that all errors set the flag.
* fix double free (closes: #711045)Michael Vogt2013-06-061-2/+5
|
* various simple changes to fix cppcheck warningsDavid Kalnischkies2013-03-101-5/+5
|
* * apt-pkg/contrib/fileutl.cc:David Kalnischkies2012-08-041-2/+0
| | | | - remove _POSIX_SYNCHRONIZED_IO guard in FileFd::Sync() around fsync as this guard is only needed for fdatasync and not defined on hurd
* * apt-pkg/contrib/fileutl.cc:David Kalnischkies2012-05-221-4/+15
| | | | - dup() given compressed fd in OpenDescriptor if AutoClose is disabled as otherwise gzclose() and co will close it
* * apt-pkg/contrib/fileutl.cc:David Kalnischkies2012-05-161-24/+41
| | | | - ensure that we close compressed fds, wait for forks and such even if the FileFd itself is set to not autoclose the given Fd
* ensure that d is set before accessing itDavid Kalnischkies2012-05-101-41/+50
|
* ensure that in error conditions the Fail flag is setDavid Kalnischkies2012-05-101-3/+46
|
* collect zombie (de)compressor processes on reopenDavid Kalnischkies2012-05-101-1/+14
|
* ensure that we do init d only once and especially not with its ownDavid Kalnischkies2012-05-091-5/+6
| | | | content as this causes some "interesting" hickups resulting in segfaults as it seems (Closes: #554387, #670979)
* * apt-pkg/contrib/fileutl.cc:David Kalnischkies2012-05-091-3/+7
| | | - check that the fd which are closed are valid
* * apt-pkg/contrib/fileutl.cc:David Kalnischkies2012-04-191-0/+6
| | | - redirect stderr from compressors to /dev/null
* use a static FileFd::Write overload to reduce duplication of write()-retry codeDavid Kalnischkies2012-04-111-0/+22
|
* - add libbz2-dev as new build-dependencyDavid Kalnischkies2012-04-051-9/+98
| | | | | | | | - remove the libz-dev alternative from zlib1g-dev build-dependency - do the same for bz2 builtin if available * apt-pkg/contrib/fileutl.cc: - use libz2 library for (de)compression instead of the bzip2 binary as the first is a dependency of dpkg and the later just priority:optional so we gain 'easier' access to bz2-compressed Translation files this way
* if we have zlib builtin insert add a dummy gzip compressor for FileFDDavid Kalnischkies2012-04-051-1/+0
|
* detect zlib correctly. We still don't allow to build without it to remainDavid Kalnischkies2012-04-051-19/+13
| | | | | compatible with users accessing it directly, but this prepares for a drop of this strict requirement in the future
* * apt-pkg/contrib/fileutl.cc:David Kalnischkies2012-03-061-0/+7
| | | - do not warn about the ignoring of directories (Closes: #662762)
* * apt-pkg/cachefile.cc:David Kalnischkies2012-02-111-0/+74
| | | - clean up lost atomic cachefiles with 'clean' (Closes: #650513)
* rework previous patch to avoid changing the inline codeMichael Vogt2012-02-031-0/+5
|
* * apt-pkg/contrib/fileutl.h:David Kalnischkies2012-01-181-1/+3
| | | | | | | | | - store the offset in the internal fd before calculate size of the zlib-handled file to jump back to this place again It jumped back to the position of the content - which is wrong as the internal fd is compressed and even reseting to the beginning of the file doesn't work as zlib uses an internal buffer, so while we might haven't read anything yet zlib might have done so already…
* improve error reporting in case of errors in combination with zlibDavid Kalnischkies2012-01-181-5/+15
|