summaryrefslogtreecommitdiff
path: root/apt-private/private-sources.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-private/private-sources.cc')
-rw-r--r--apt-private/private-sources.cc5
1 files changed, 5 insertions, 0 deletions
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(