}
#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! */
/* 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);
*****************************************************************/
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);
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
*
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)
**************************************************************************/