From 983ef994ba0c19e58da135cfacc7ac651ee8daee Mon Sep 17 00:00:00 2001 From: franklahm Date: Tue, 17 Nov 2009 11:41:37 +0000 Subject: [PATCH] Make Solaris EA code compile again --- include/atalk/ea.h | 12 +++++++++++- libatalk/adouble/ad_ea.c | 32 +++++++++----------------------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/include/atalk/ea.h b/include/atalk/ea.h index 8fff1e71..594ac618 100644 --- a/include/atalk/ea.h +++ b/include/atalk/ea.h @@ -1,5 +1,5 @@ /* - $Id: ea.h,v 1.6 2009-11-13 13:03:29 didg Exp $ + $Id: ea.h,v 1.7 2009-11-17 11:41:37 franklahm Exp $ Copyright (c) 2009 Frank Lahm This program is free software; you can redistribute it and/or modify @@ -51,6 +51,16 @@ enum { kXAttrReplace = 0x4 }; +#if !defined(HAVE_SETXATTR) +#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ +#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ +#endif + + +/**************************************************************************************** + * Stuff for our implementation of storing EAs in files in .AppleDouble dirs + ****************************************************************************************/ + #define EA_INITED 0xea494e54 /* ea"INT", for interfacing ea_open w. ea_close */ #define EA_MAGIC 0x61644541 /* "adEA" */ #define EA_VERSION1 0x01 diff --git a/libatalk/adouble/ad_ea.c b/libatalk/adouble/ad_ea.c index d691cbec..64aeb03f 100644 --- a/libatalk/adouble/ad_ea.c +++ b/libatalk/adouble/ad_ea.c @@ -21,7 +21,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Samba 3.0.28, modified for netatalk. - $Id: ad_ea.c,v 1.5 2009-11-13 13:31:13 didg Exp $ + $Id: ad_ea.c,v 1.6 2009-11-17 11:41:37 franklahm Exp $ */ @@ -30,8 +30,8 @@ #endif #include - #include +#include #if HAVE_ATTR_XATTR_H #include @@ -43,6 +43,11 @@ #include #endif +#ifdef HAVE_ATTROPEN + +#include +#endif + #ifdef HAVE_SYS_EXTATTR_H #include #endif @@ -50,6 +55,7 @@ #include #include #include +#include /******** Solaris EA helper function prototypes ********/ #ifdef HAVE_ATTROPEN @@ -527,11 +533,6 @@ int sys_lremovexattr (const char *path, const char *uname) #endif } -#if !defined(HAVE_SETXATTR) -#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ -#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ -#endif - int sys_setxattr (const char *path, const char *uname, const void *value, size_t size, int flags) { const char *name = prefix(uname); @@ -672,7 +673,6 @@ static ssize_t solaris_read_xattr(int attrfd, void *value, size_t size) struct stat sbuf; if (fstat(attrfd, &sbuf) == -1) { - errno = ENOATTR; return -1; } @@ -683,7 +683,6 @@ static ssize_t solaris_read_xattr(int attrfd, void *value, size_t size) /* check size and read xattr */ if (sbuf.st_size > size) { - errno = ERANGE; return -1; } @@ -706,7 +705,7 @@ static ssize_t solaris_list_xattr(int attrdirfd, char *list, size_t size) while ((de = readdir(dirp))) { size_t listlen; if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..") || - !strcmp(dp->d_name, "SUNWattr_ro") || !strcmp(dp->d_name, "SUNWattr_rw")) + !strcmp(de->d_name, "SUNWattr_ro") || !strcmp(de->d_name, "SUNWattr_rw")) { /* we don't want "." and ".." here: */ LOG(log_maxdebug, logtype_default, "skipped EA %s\n",de->d_name); @@ -742,9 +741,6 @@ static ssize_t solaris_list_xattr(int attrdirfd, char *list, size_t size) static int solaris_unlinkat(int attrdirfd, const char *name) { if (unlinkat(attrdirfd, name, 0) == -1) { - if (errno == ENOENT) { - errno = ENOATTR; - } return -1; } return 0; @@ -755,11 +751,6 @@ static int solaris_attropen(const char *path, const char *attrpath, int oflag, m int filedes = attropen(path, attrpath, oflag, mode); if (filedes == -1) { LOG(log_maxdebug, logtype_default, "attropen FAILED: path: %s, name: %s, errno: %s\n",path,attrpath,strerror(errno)); - if (errno == EINVAL) { - errno = ENOTSUP; - } else { - errno = ENOATTR; - } } return filedes; } @@ -769,11 +760,6 @@ static int solaris_openat(int fildes, const char *path, int oflag, mode_t mode) int filedes = openat(fildes, path, oflag, mode); if (filedes == -1) { LOG(log_maxdebug, logtype_default, "openat FAILED: fd: %s, path: %s, errno: %s\n",filedes,path,strerror(errno)); - if (errno == EINVAL) { - errno = ENOTSUP; - } else { - errno = ENOATTR; - } } return filedes; } -- 2.39.2