From 5ec122952ff5835479f7441291dc8fdbb7796de1 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 5 Mar 2013 17:40:22 +0100 Subject: [PATCH] sys_lsetxattr error messages when mounting read only filesystem Fixes bug #504. --- NEWS | 2 ++ include/atalk/adouble.h | 1 + libatalk/adouble/ad_conv.c | 3 +++ libatalk/adouble/ad_open.c | 4 ++++ libatalk/util/netatalk_conf.c | 2 ++ 5 files changed, 12 insertions(+) diff --git a/NEWS b/NEWS index 42f7d498..35f9ea2b 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,8 @@ Changes in 3.0.3 Fixes bug #501. * FIX: Conversion from adouble v2 to ea for directories. Fixes bug #500. +* FIX: Error messages when mounting read-only filesystems. + Fixes bug #504. Changes in 3.0.2 ================ diff --git a/include/atalk/adouble.h b/include/atalk/adouble.h index fd870876..de0598b5 100644 --- a/include/atalk/adouble.h +++ b/include/atalk/adouble.h @@ -245,6 +245,7 @@ struct adouble { #define ADFLAGS_TRUNC (1<<12) /* truncate, open called with O_TRUNC */ #define ADVOL_NODEV (1 << 0) +#define ADVOL_RO (1 << 1) #define ADVOL_UNIXPRIV (1 << 2) /* adouble unix priv */ #define ADVOL_INVDOTS (1 << 3) /* dot files (.DS_Store) are invisible) */ #define ADVOL_FOLLO_SYML (1 << 4) diff --git a/libatalk/adouble/ad_conv.c b/libatalk/adouble/ad_conv.c index 486b0313..c68cad45 100644 --- a/libatalk/adouble/ad_conv.c +++ b/libatalk/adouble/ad_conv.c @@ -264,6 +264,9 @@ int ad_convert(const char *path, const struct stat *sp, const struct vol *vol, c if (newpath) *newpath = NULL; + if (vol->v_flags & AFPVOL_RO) + EC_EXIT_STATUS(0); + if ((vol->v_adouble == AD_VERSION_EA) && !(vol->v_flags & AFPVOL_NOV2TOEACONV)) EC_ZERO( ad_conv_v22ea(path, sp, vol) ); diff --git a/libatalk/adouble/ad_open.c b/libatalk/adouble/ad_open.c index cd45fef2..4e1253d1 100644 --- a/libatalk/adouble/ad_open.c +++ b/libatalk/adouble/ad_open.c @@ -1087,6 +1087,10 @@ static int ad_open_hf_ea(const char *path, int adflags, int mode, struct adouble errno = ENOENT; EC_FAIL; } + if ((adflags & ADFLAGS_CREATE) && (ad->ad_options & ADVOL_RO)) { + errno = EROFS; + EC_FAIL; + } LOG(log_debug, logtype_ad, "ad_open_hf_ea(\"%s\"): creating metadata EA", path); diff --git a/libatalk/util/netatalk_conf.c b/libatalk/util/netatalk_conf.c index fdc7e556..6445d3fe 100644 --- a/libatalk/util/netatalk_conf.c +++ b/libatalk/util/netatalk_conf.c @@ -801,6 +801,8 @@ static struct vol *creatvol(AFPObj *obj, volume->v_ad_options |= ADVOL_INVDOTS; if ((volume->v_flags & AFPVOL_FOLLOWSYM)) volume->v_ad_options |= ADVOL_FOLLO_SYML; + if ((volume->v_flags & AFPVOL_RO)) + volume->v_ad_options |= ADVOL_RO; /* Mac to Unix conversion flags*/ if ((volume->v_flags & AFPVOL_EILSEQ)) -- 2.39.2