]> arthur.barton.de Git - netatalk.git/commitdiff
Move fullpathname() around in libatalk
authorFrank Lahm <franklahm@googlemail.com>
Mon, 12 Sep 2011 12:15:17 +0000 (14:15 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Mon, 12 Sep 2011 12:15:17 +0000 (14:15 +0200)
bin/adv1tov2/adv1tov2.c
include/atalk/unix.h
include/atalk/util.h
libatalk/util/unix.c
libatalk/vfs/unix.c

index d4a66fba98b9e14fdeb2b408f1793b50bea34711..eade898b5d3fba6a8f89e88dd2574ff7f83a76f7 100644 (file)
@@ -58,21 +58,6 @@ static void xlate(char *name, int flags) {
 }
 #endif
 
-/* ----------------------------- */
-char *fullpathname(const char *name)
-{
-    static char wd[ MAXPATHLEN + 1];
-
-    if ( getcwd( wd , MAXPATHLEN) ) {
-        strlcat(wd, "/", MAXPATHLEN);
-        strlcat(wd, name, MAXPATHLEN);
-    }
-    else {
-        strlcpy(wd, name, MAXPATHLEN);
-    }
-    return wd;
-}
-
 #define MAXDESCEND 0xFFFF
 /* recursively descend subdirectories. 
  * oh the stack space we use up! */
index 06e3f49391dd7feea4e0998b805e9dcbfb4e9406..f6d191ca6000d21f1613cad1a3fd6afb47083786 100644 (file)
@@ -26,7 +26,6 @@
 /* vfs/unix.c */
 extern int netatalk_unlink(const char *name);
 extern int netatalk_unlinkat(int dirfd, const char *name);
-extern char *fullpathname(const char *);
 extern int statat(int dirfd, const char *path, struct stat *st);
 extern int lstatat(int dirfd, const char *path, struct stat *st);
 extern DIR *opendirat(int dirfd, const char *path);
index bcf7e70816b461d0869b0646ad16011eb82719c7..67a68d5df9f856f85d4e6c625e004c128abe43c5 100644 (file)
@@ -177,6 +177,7 @@ extern int recv_fd(int fd, int nonblocking);
  *****************************************************************/
 
 extern const char *getcwdpath(void);
+extern const char *fullpathname(const char *);
 extern char *stripped_slashes_basename(char *p);
 extern int lchdir(const char *dir);
 extern void randombytes(void *buf, int n);
index c16c5da5b50d1514243a29c0afb3edd9bd7593f6..0e466307bcd30d6ad13ec3af0c8444be0b26bd45 100644 (file)
@@ -110,6 +110,28 @@ const char *getcwdpath(void)
         return strerror(errno);
 }
 
+/*!
+ * @brief Request absolute path
+ *
+ * @returns Absolute filesystem path to object
+ */
+const char *fullpathname(const char *name)
+{
+    static char wd[MAXPATHLEN + 1];
+
+    if (name[0] == '/')
+        return name;
+
+    if (getcwd(wd , MAXPATHLEN)) {
+        strlcat(wd, "/", MAXPATHLEN);
+        strlcat(wd, name, MAXPATHLEN);
+    } else {
+        strlcpy(wd, name, MAXPATHLEN);
+    }
+
+    return wd;
+}
+
 /*!
  * Takes a buffer with a path, strips slashs, returns basename
  *
index 229f1b7a216e25309c3c581c5c9fcc6e3a1ca6e5..cc053c91b35dd6935cbf28f60ba5682bc3555a23 100644 (file)
@@ -168,21 +168,6 @@ int netatalk_unlink(const char *name)
     return AFP_OK;
 }
 
-char *fullpathname(const char *name)
-{
-    static char wd[ MAXPATHLEN + 1];
-
-    if ( getcwd( wd , MAXPATHLEN) ) {
-        strlcat(wd, "/", MAXPATHLEN);
-        strlcat(wd, name, MAXPATHLEN);
-    }
-    else {
-        strlcpy(wd, name, MAXPATHLEN);
-    }
-    return wd;
-}
-
-
 /**************************************************************************
  * *at semnatics support functions (like openat, renameat standard funcs)
  **************************************************************************/