changeset 9165:c69a1d0a6bd6 HEAD

eacces_error_get(): Check also if user had write permissions to the given file.
author Timo Sirainen <tss@iki.fi>
date Sat, 27 Jun 2009 18:51:06 -0400
parents 9214dd33a2a5
children 60c8ea46c740
files src/lib/eacces-error.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/eacces-error.c	Sat Jun 27 18:01:18 2009 -0400
+++ b/src/lib/eacces-error.c	Sat Jun 27 18:51:06 2009 -0400
@@ -135,6 +135,12 @@
 			   test_access(path, R_OK, errmsg) < 0) {
 			if (errno == EACCES)
 				str_printfa(errmsg, " missing +r perm: %s", path);
+		} else if (!creating && test_access(path, W_OK, errmsg) < 0) {
+			/* this produces a wrong error if the operation didn't
+			   actually need write permissions, but we don't know
+			   it here.. */
+			if (errno == EACCES)
+				str_printfa(errmsg, " missing +w perm: %s", path);
 		} else
 			str_printfa(errmsg, " UNIX perms seem ok, ACL problem?");
 	}