mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-23 21:17:11 -05:00
daemon: Make "opening file" error messages distinguishable.
* nix/libstore/build.cc (DerivationGoal::openLogFile): Customize "opening file" error message. * nix/libutil/hash.cc (hashFile): Likewise. * nix/libutil/util.cc (readFile, writeFile): Likewise.
This commit is contained in:
parent
239bfe2ec1
commit
2d4d26769d
3 changed files with 4 additions and 4 deletions
|
@ -2576,7 +2576,7 @@ Path DerivationGoal::openLogFile()
|
|||
closeOnExec(fd);
|
||||
|
||||
if (!(fLogFile = fdopen(fd.borrow(), "w")))
|
||||
throw SysError(format("opening file `%1%'") % logFileName);
|
||||
throw SysError(format("opening log file `%1%'") % logFileName);
|
||||
|
||||
int err;
|
||||
if (!(bzLogFile = BZ2_bzWriteOpen(&err, fLogFile, 9, 0, 0)))
|
||||
|
|
|
@ -244,7 +244,7 @@ Hash hashFile(HashType ht, const Path & path)
|
|||
start(ht, ctx);
|
||||
|
||||
AutoCloseFD fd = open(path.c_str(), O_RDONLY);
|
||||
if (fd == -1) throw SysError(format("opening file `%1%'") % path);
|
||||
if (fd == -1) throw SysError(format("computing hash of file `%1%'") % path);
|
||||
|
||||
unsigned char buf[8192];
|
||||
ssize_t n;
|
||||
|
|
|
@ -264,7 +264,7 @@ string readFile(const Path & path, bool drain)
|
|||
{
|
||||
AutoCloseFD fd = open(path.c_str(), O_RDONLY);
|
||||
if (fd == -1)
|
||||
throw SysError(format("opening file `%1%'") % path);
|
||||
throw SysError(format("reading file `%1%'") % path);
|
||||
return drain ? drainFD(fd) : readFile(fd);
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ void writeFile(const Path & path, const string & s)
|
|||
{
|
||||
AutoCloseFD fd = open(path.c_str(), O_WRONLY | O_TRUNC | O_CREAT, 0666);
|
||||
if (fd == -1)
|
||||
throw SysError(format("opening file '%1%'") % path);
|
||||
throw SysError(format("writing file '%1%'") % path);
|
||||
writeFull(fd, s);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue