Change to use POSIX getcwd() instead of getwd()
authorTheodore Tso <tytso@mit.edu>
Sat, 16 Jul 1994 03:47:03 +0000 (03:47 +0000)
committerTheodore Tso <tytso@mit.edu>
Sat, 16 Jul 1994 03:47:03 +0000 (03:47 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3985 dc483132-0cff-0310-8789-dd5450dbe970

src/clients/ksu/ChangeLog [new file with mode: 0644]
src/clients/ksu/main.c

diff --git a/src/clients/ksu/ChangeLog b/src/clients/ksu/ChangeLog
new file mode 100644 (file)
index 0000000..334e790
--- /dev/null
@@ -0,0 +1,5 @@
+Fri Jul 15 23:45:34 1994  Theodore Y. Ts'o  (tytso at tsx-11)
+
+       * ksu.c (get_dir_of_file): Change to use POSIX getcwd() function.
+
+
index dfe8db2c3b544973d84fb4f612c7659fc7505fcc..909ada3fe6865b9d86d8eee3331af31eea29db61 100644 (file)
@@ -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;  
 }