summaryrefslogtreecommitdiff
path: root/cmdline/apt-internal-solver.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-04-26 12:26:12 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-05-20 14:18:36 +0200
commitef00bd7af5b2bc0625df58482eacb4c2873c3647 (patch)
treecd9ac98b30dc14c3f239ff5883cc96696157a997 /cmdline/apt-internal-solver.cc
parentfdf9eef4d96a18d0167708499c993e1174251e88 (diff)
convert EDSP to be based on FileFd instead of FILE*
I doubt there is any non-src:apt usage of these interfaces.
Diffstat (limited to 'cmdline/apt-internal-solver.cc')
-rw-r--r--cmdline/apt-internal-solver.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
index b88d745c4..2df1d3bef 100644
--- a/cmdline/apt-internal-solver.cc
+++ b/cmdline/apt-internal-solver.cc
@@ -82,12 +82,14 @@ int main(int argc,const char *argv[]) /*{{{*/
pkgCacheFile CacheFile;
CacheFile.Open(NULL, false);
APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
- FILE* output = stdout;
+ FileFd output;
+ if (output.OpenDescriptor(STDOUT_FILENO, FileFd::WriteOnly | FileFd::BufferedWrite, true) == false)
+ return 2;
if (pkgset.empty() == true)
EDSP::WriteScenario(CacheFile, output);
else
EDSP::WriteLimitedScenario(CacheFile, output, pkgset);
- fclose(output);
+ output.Close();
_error->DumpErrors(std::cerr);
return 0;
}
@@ -102,8 +104,10 @@ int main(int argc,const char *argv[]) /*{{{*/
_config->Set("APT::System", "Debian APT solver interface");
_config->Set("APT::Solver", "internal");
_config->Set("edsp::scenario", "/nonexistent/stdin");
- int input = STDIN_FILENO;
- FILE* output = stdout;
+ FileFd output;
+ if (output.OpenDescriptor(STDOUT_FILENO, FileFd::WriteOnly | FileFd::BufferedWrite, true) == false)
+ DIE("stdout couldn't be opened");
+ int const input = STDIN_FILENO;
SetNonBlock(input, false);
EDSP::WriteProgress(0, "Start up solver…", output);