[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] Explain why files cannot be read
From: |
John Darrington |
Subject: |
[PATCH 1/2] Explain why files cannot be read |
Date: |
Mon, 11 Nov 2019 20:05:00 +0100 |
* src/pk-file.c (pk_cmd_file): Use strerror for reason.
(pk_cmd_load_file): ditto.
---
src/pk-file.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/pk-file.c b/src/pk-file.c
index 82c391c..54e6524 100644
--- a/src/pk-file.c
+++ b/src/pk-file.c
@@ -21,6 +21,7 @@
#include <unistd.h>
#include <gettext.h>
#define _(str) dgettext (PACKAGE, str)
+#include <errno.h>
#include "ios.h"
#include "poke.h"
@@ -59,7 +60,8 @@ pk_cmd_file (int argc, struct pk_cmd_arg argv[], uint64_t
uflags)
if (access (arg_str, R_OK) != 0)
{
- pk_printf (_("%s: file cannot be read\n"), arg_str);
+ char *why = strerror (errno);
+ pk_printf (_("%s: file cannot be read: %s\n"), arg_str, why);
return 0;
}
@@ -187,7 +189,10 @@ pk_cmd_load_file (int argc, struct pk_cmd_arg argv[],
uint64_t uflags)
return 1;
no_file:
- pk_printf (_("%s: file cannot be read\n"), arg);
+ {
+ char *why = strerror (errno);
+ pk_printf (_("%s: file cannot be read: %s\n"), arg, why);
+ }
error:
free (filename);
return 0;
--
2.11.0
- [PATCH 1/2] Explain why files cannot be read,
John Darrington <=