From 43044f01479513de1fc024d2e61ac7c4648799d1 Mon Sep 17 00:00:00 2001
From: Brandon Rodriguez <brodriguez8774@gmail.com>
Date: Fri, 6 Oct 2017 17:28:18 -0400
Subject: [PATCH] Improve handling for permissions

---
 Main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Main.c b/Main.c
index 639c94c..dd9750b 100644
--- a/Main.c
+++ b/Main.c
@@ -184,9 +184,9 @@ int change_directory(char* given_path) {
 
     // First, ensure that it is, infact, a directory.
     if (S_ISDIR(stat_buffer.st_mode)) {
-        // Next, check permissions. Only change upon owner permission.
-        if (stat_buffer.st_mode & S_IXUSR) {
-            // Change directory.
+        // Next, check permissions.
+        if ((access(given_path, X_OK)) == 0) {
+            // Change into directory.
             return_int = chdir(given_path);
             if (return_int < 0) {
                 err_sys("Failed to change directory.");
-- 
GitLab