From c189f87d57844a13619ec387916f49aba171c1b3 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Jan 2014 08:12:28 +0100 Subject: flock() the file edited in edit-sources --- apt-private/private-sources.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'apt-private/private-sources.cc') diff --git a/apt-private/private-sources.cc b/apt-private/private-sources.cc index 65706e785..41cf6b313 100644 --- a/apt-private/private-sources.cc +++ b/apt-private/private-sources.cc @@ -32,6 +32,10 @@ bool EditSources(CommandLine &CmdL) if (FileExists(sourceslist)) before.FromFile(sourceslist); + int lockfd = GetLock(sourceslist); + if (lockfd < 0) + return false; + do { EditFileInSensibleEditor(sourceslist); _error->PushToStack(); @@ -46,6 +50,7 @@ bool EditSources(CommandLine &CmdL) } _error->RevertToStack(); } while (res == false); + close(lockfd); if (FileExists(sourceslist) && !before.VerifyFile(sourceslist)) { strprintf( -- cgit v1.2.3 From 453b82a388013e522b3a1b9fcd6ed0810dab1f4f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Mar 2014 22:11:25 +0100 Subject: cleanup headers and especially #includes everywhere 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) --- apt-private/private-sources.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'apt-private/private-sources.cc') diff --git a/apt-private/private-sources.cc b/apt-private/private-sources.cc index 41cf6b313..301936b9d 100644 --- a/apt-private/private-sources.cc +++ b/apt-private/private-sources.cc @@ -1,10 +1,23 @@ +#include #include -#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include -#include "private-output.h" -#include "private-sources.h" -#include "private-utils.h" +#include +#include +#include +#include + +#include /* Interface discussion with donkult (for the future): apt [add-{archive,release,component}|edit|change-release|disable]-sources -- cgit v1.2.3