[PATCH] Shows an error about wrong permissions

Salvo 'LtWorf' Tomaselli tiposchi at tiscali.it
Wed Nov 12 12:09:57 PST 2014


If an import fails, the permissions of the device are tested and an
error message that mentions permissions is shown to the user.
---
 libdivecomputer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libdivecomputer.c b/libdivecomputer.c
index 981061b..fca1562 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -870,7 +870,9 @@ const char *do_libdivecomputer_import(device_data_t *data)
 		err = do_device_import(data);
 		/* TODO: Show the logfile to the user on error. */
 		dc_device_close(data->device);
-	}
+	} else if (access(data->devname, R_OK | W_OK) != 0)
+		err = translate("gettextFromC", "Insufficient privileges to open the device %s %s (%s)");
+
 	dc_context_free(data->context);
 
 	if (fp) {
-- 
2.1.3



More information about the subsurface mailing list