summaryrefslogtreecommitdiffstats
path: root/src/clients/ksu/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/clients/ksu/main.c')
-rw-r--r--src/clients/ksu/main.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/clients/ksu/main.c b/src/clients/ksu/main.c
index dfe8db2c3..909ada3fe 100644
--- a/src/clients/ksu/main.c
+++ b/src/clients/ksu/main.c
@@ -933,20 +933,20 @@ va_list ap;
}
-char * get_dir_of_file( char * path){
-
-char * temp_path;
-char * ptr;
+char *get_dir_of_file(char * path)
+{
+ char * temp_path;
+ char * ptr;
-temp_path = strdup(path);
+ temp_path = strdup(path);
-if (ptr = strrchr( temp_path, '/')){
+ if (ptr = strrchr( temp_path, '/')) {
*ptr = '\0';
-}else{
+ } else {
free (temp_path);
- temp_path = (char *) calloc(MAXPATHLEN, sizeof(char));
- temp_path = (char *) getwd(temp_path);
-}
-
-return temp_path;
+ temp_path = malloc(MAXPATHLEN);
+ if (temp_path)
+ getcwd(temp_path, MAXPATHLEN);
+ }
+ return temp_path;
}