Skip to content

Commit

Permalink
Remove dependency on libexplain
Browse files Browse the repository at this point in the history
This is a more elegant solution to jduncanator#13, as it doesn't require an
external library to generate string messages for the error number.
  • Loading branch information
jduncanator committed May 3, 2017
1 parent 6cbc07c commit 61bae49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/diskusage_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#include <stdexcept>
#include <sys/statvfs.h>
#include <errno.h>
#include <string.h>

DiskUsage GetDiskUsage(const char* path)
{
struct statvfs info = {};

if (statvfs(path, &info)) {
char message[3000];
explain_message_statvfs(message, sizeof(message), path, &info);
throw SystemError(errno, "statvfs", message, path);
int errnum = errno;
throw SystemError(errnum, "statvfs", strerror(errnum), path);
}

DiskUsage result;
Expand Down

0 comments on commit 61bae49

Please sign in to comment.