Skip to content

Commit 61bae49

Browse files
committed
Remove dependency on libexplain
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.
1 parent 6cbc07c commit 61bae49

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/diskusage_posix.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#include <stdexcept>
44
#include <sys/statvfs.h>
55
#include <errno.h>
6+
#include <string.h>
67

78
DiskUsage GetDiskUsage(const char* path)
89
{
910
struct statvfs info = {};
1011

1112
if (statvfs(path, &info)) {
12-
char message[3000];
13-
explain_message_statvfs(message, sizeof(message), path, &info);
14-
throw SystemError(errno, "statvfs", message, path);
13+
int errnum = errno;
14+
throw SystemError(errnum, "statvfs", strerror(errnum), path);
1515
}
1616

1717
DiskUsage result;

0 commit comments

Comments
 (0)