---
 testcases/kernel/syscalls/sysctl/sysctl03.c |   57 ++++++++++++++++++----------
 1 file changed, 37 insertions(+), 20 deletions(-)

--- a/testcases/kernel/syscalls/sysctl/sysctl03.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl03.c
@@ -113,16 +113,25 @@ int main(int ac, char **av)
 			tst_resm(TFAIL, "sysctl(2) succeeded unexpectedly");
 		} else {
 			TEST_ERROR_LOG(TEST_ERRNO);
-
-			if (TEST_ERRNO != EPERM) {
-				tst_resm(TFAIL,
-					 "Expected EPERM (%d), got %d: %s",
-					 EPERM, TEST_ERRNO,
-					 strerror(TEST_ERRNO));
-			} else {
-				tst_resm(TPASS, "Got expected EPERM error");
+			if (tst_kvercmp(2,6,34)<0){
+				if (TEST_ERRNO != EPERM) {
+					tst_resm(TFAIL,
+							"Expected EPERM (%d), got %d: %s",
+							EPERM, TEST_ERRNO,
+							strerror(TEST_ERRNO));
+				} else {
+					tst_resm(TPASS, "Got expected EPERM error");
+				} else {
+					if (TEST_ERRNO != EACCES) {
+						tst_resm(TFAIL,
+								"Expected EACCES(%d), got %d: %s",
+								EACCES, TEST_ERRNO,
+								strerror(TEST_ERRNO));
+					} else {
+						tst_resm(TPASS, "Got expected EACCES error");
+					}
+				}
 			}
-		}
 
 		osnamelth = SIZE(osname);
 		if ((ltpuser = getpwnam("nobody")) == NULL) {
@@ -146,20 +155,28 @@ int main(int ac, char **av)
 				tst_resm(TFAIL, "call succeeded unexpectedly");
 			} else {
 				TEST_ERROR_LOG(TEST_ERRNO);
-
-				if (TEST_ERRNO != EPERM) {
-					tst_resm(TFAIL, "Expected EPERM, got "
-						 "%d", TEST_ERRNO);
-				} else {
-					tst_resm(TPASS, "Got expected EPERM "
-						 "error");
+				if (tst_kvercmp(2,6,34)<0){
+					if (TEST_ERRNO != EPERM) {
+						tst_resm(TFAIL, "Expected EPERM, got "
+								"%d", TEST_ERRNO);
+					} else {
+						tst_resm(TPASS, "Got expected EPERM "
+								"error");
+					} else{
+						if (TEST_ERRNO != EACCES) {
+							tst_resm(TFAIL, "Expected EACCES, got "
+									"%d", TEST_ERRNO);
+						} else {
+							tst_resm(TPASS, "Got expected EACCES"
+									"error");
+						}
+					}
 				}
-			}
 
-			cleanup();
+				cleanup();
 
-		} else {	/* parent */
-			/* wait for the child to finish */
+			} else {	/* parent */
+				/* wait for the child to finish */
 			wait(&status);
 		}
 
