X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=blobdiff_plain;f=libatalk%2Fvfs%2Funix.c;h=846aa7206933defac01a2efff09db8831bed77d1;hp=1c0556d95e2eebc2e9baeccc34227a112ceeed8a;hb=c72d10d6f92fe81d040ab983768d7fdccea7fb2e;hpb=a83e8197c7b8af45f8d56acf158920c03698bfc6 diff --git a/libatalk/vfs/unix.c b/libatalk/vfs/unix.c index 1c0556d9..846aa720 100644 --- a/libatalk/vfs/unix.c +++ b/libatalk/vfs/unix.c @@ -33,7 +33,7 @@ int dir_rx_set(mode_t mode) } /* --------------------- */ -int setfilmode(const char * name, mode_t mode, struct stat *st, mode_t v_umask) +int setfilmode(const struct vol *vol, const char *name, mode_t mode, struct stat *st) { struct stat sb; mode_t mask = S_IRWXU | S_IRWXG | S_IRWXO; /* rwx for owner group and other, by default */ @@ -44,12 +44,13 @@ int setfilmode(const char * name, mode_t mode, struct stat *st, mode_t v_umask) st = &sb; } - if (S_ISLNK(st->st_mode)) - return 0; /* we don't want to change link permissions */ - mode |= st->st_mode & ~mask; /* keep other bits from previous mode */ - if ( chmod_acl( name, mode & ~v_umask ) < 0 && errno != EPERM ) { + if (ochmod((char *)name, + mode & ~vol->v_umask, + st, + vol_syml_opt(vol) | vol_chmod_opt(vol) + ) < 0 && errno != EPERM ) { return -1; } return 0; @@ -77,6 +78,7 @@ int netatalk_rmdir_all_errors(int dirfd, const char *name) case ENOENT : return AFPERR_NOOBJ; case ENOTEMPTY : + case EEXIST: return AFPERR_DIRNEMPT; case EPERM: case EACCES : @@ -169,9 +171,6 @@ int copy_file(int dirfd, const char *src, const char *dst, mode_t mode) int ret = 0; int sfd = -1; int dfd = -1; - ssize_t cc; - size_t buflen; - char filebuf[NETATALK_DIOSZ_STACK]; #ifdef HAVE_ATFUNCS if (dirfd == -1) @@ -334,29 +333,6 @@ int statat(int dirfd, const char *path, struct stat *st) return -1; } -/* - * @brief lstat/fsstatat multiplexer - * - * lstatat mulitplexes lstat and fstatat. If we dont HAVE_ATFUNCS, dirfd is ignored. - * - * @param dirfd (r) Only used if HAVE_ATFUNCS, ignored else, -1 gives AT_FDCWD - * @param path (r) pathname - * @param st (rw) pointer to struct stat - */ -int lstatat(int dirfd, const char *path, struct stat *st) -{ -#ifdef HAVE_ATFUNCS - if (dirfd == -1) - dirfd = AT_FDCWD; - return (fstatat(dirfd, path, st, AT_SYMLINK_NOFOLLOW)); -#else - return (lstat(path, st)); -#endif - - /* DEADC0DE */ - return -1; -} - /* * @brief opendir wrapper for *at semantics support *