From e8c5b8f25744bba22869d59435fa1c72222a90f5 Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Mon, 28 Nov 2011 17:17:21 +0100 Subject: [PATCH] Merge fixes --- etc/afpd/fork.c | 19 ++++--------------- etc/cnid_dbd/cmd_dbd_scanvol.c | 2 +- include/atalk/Makefile.am | 1 - include/atalk/util.h | 1 - libatalk/adouble/ad_open.c | 12 ++++++------ libatalk/compat/misc.c | 12 ------------ libatalk/dsi/dsi_cmdreply.c | 1 - libatalk/vfs/vfs.c | 27 --------------------------- 8 files changed, 11 insertions(+), 64 deletions(-) diff --git a/etc/afpd/fork.c b/etc/afpd/fork.c index 2887f93e..ad92ff4a 100644 --- a/etc/afpd/fork.c +++ b/etc/afpd/fork.c @@ -269,7 +269,7 @@ int afp_openfork(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, si LOG(log_debug, logtype_afpd, "afp_openfork(\"%s\", %s)", - abspath(s_path->u_name), + fullpathname(s_path->u_name), (fork & OPENFORK_RSCS) ? "OPENFORK_RSCS" : "OPENFORK_DATA"); /* stat() data fork st is set because it's not a dir */ @@ -405,7 +405,7 @@ int afp_openfork(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, si break; default: LOG(log_error, logtype_afpd, "afp_openfork(\"%s\"): %s", - abspath(s_path->m_name), strerror(errno) ); + fullpathname(s_path->m_name), strerror(errno) ); goto openfork_err; break; } @@ -879,14 +879,10 @@ static int read_fork(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, si goto afp_read_err; } -<<<<<<< HEAD -#define min(a,b) ((a)<(b)?(a):(b)) - *rbuflen = min( reqcount, *rbuflen ); -======= *rbuflen = MIN(reqcount, *rbuflen); LOG(log_debug, logtype_afpd, "afp_read(name: \"%s\", offset: %jd, reqcount: %jd): reading %jd bytes from file", of_name(ofork), (intmax_t)offset, (intmax_t)reqcount, (intmax_t)*rbuflen); ->>>>>>> netafp/master + err = read_file(ofork, eid, offset, nlmask, nlchar, rbuf, rbuflen, xlate); if (err < 0) goto afp_read_done; @@ -1178,17 +1174,10 @@ static ssize_t write_file(struct ofork *ofork, int eid, * in reqcount et al. */ static int write_fork(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen, int is64) { -<<<<<<< HEAD struct ofork *ofork; - off_t offset, saveoff, reqcount; + off_t offset, saveoff, reqcount, oldsize, newsize; int endflag, eid, xlate = 0, err = AFP_OK; uint16_t ofrefnum; -======= - struct ofork *ofork; - off_t offset, saveoff, reqcount, oldsize, newsize; - int endflag, eid, xlate = 0, err = AFP_OK; - u_int16_t ofrefnum; ->>>>>>> netafp/master ssize_t cc; /* figure out parameters */ diff --git a/etc/cnid_dbd/cmd_dbd_scanvol.c b/etc/cnid_dbd/cmd_dbd_scanvol.c index d661071d..75f51fa6 100644 --- a/etc/cnid_dbd/cmd_dbd_scanvol.c +++ b/etc/cnid_dbd/cmd_dbd_scanvol.c @@ -761,7 +761,7 @@ static cnid_t check_cnid(const char *name, cnid_t did, struct stat *st, int adfi dbd_log(LOGSTD, "Updating AppleDouble file for '%s/%s' with CNID: %u from database", cwdbuf, name, ntohl(db_cnid)); ad_init(&ad, myvolinfo->v_adouble, myvolinfo->v_ad_options); - if (ad_open_metadata( name, adflags, O_RDWR, &ad) != 0) { + if (ad_open(&ad, name, adflags | ADFLAGS_HF, O_RDWR, 0666, &ad) != 0) { dbd_log(LOGSTD, "Error opening AppleDouble file for '%s/%s': %s", cwdbuf, name, strerror(errno)); return CNID_INVALID; diff --git a/include/atalk/Makefile.am b/include/atalk/Makefile.am index f4c2258d..bb4beae1 100644 --- a/include/atalk/Makefile.am +++ b/include/atalk/Makefile.am @@ -37,7 +37,6 @@ noinst_HEADERS = \ talloc.h \ tevent.h \ tsocket.h \ - boolean.h \ compat.h \ dsi.h \ ldapconfig.h \ diff --git a/include/atalk/util.h b/include/atalk/util.h index 1febc062..7fbae2df 100644 --- a/include/atalk/util.h +++ b/include/atalk/util.h @@ -175,7 +175,6 @@ extern int recv_fd(int fd, int nonblocking); * unix.c *****************************************************************/ -extern const char *abspath(const char *name); extern const char *getcwdpath(void); extern const char *fullpathname(const char *); extern char *stripped_slashes_basename(char *p); diff --git a/libatalk/adouble/ad_open.c b/libatalk/adouble/ad_open.c index ea4ee240..ffb188ea 100644 --- a/libatalk/adouble/ad_open.c +++ b/libatalk/adouble/ad_open.c @@ -506,7 +506,7 @@ static int ad_open_df(const char *path, int adflags, int oflags, int mode, struc int st_invalid = -1; LOG(log_debug, logtype_default, "ad_open_df(\"%s\", %s, %04o)", - abspath(path), oflags2logstr(oflags), mode); + fullpathname(path), oflags2logstr(oflags), mode); if (ad_data_fileno(ad) == -1) { hoflags = (oflags & ~(O_RDONLY | O_WRONLY)) | O_RDWR; @@ -591,7 +591,7 @@ static int ad_open_hf_v2(const char *path, int adflags, int oflags, int mode, st * if ((oflags & O_CREAT) ==> (oflags & O_RDWR) */ LOG(log_debug, logtype_default, "ad_open(\"%s\"): creating adouble file", - abspath(path)); + fullpathname(path)); admode = mode; errno = 0; st_invalid = ad_mode_st(ad_p, &admode, &st_dir); @@ -680,7 +680,7 @@ static int ad_open_hf_ea(const char *path, int adflags, int oflags, int mode, st /* Create one */ if (new_ad_header(path, ad, adflags) < 0) { LOG(log_error, logtype_default, "ad_open_hf_ea: can't create new header: %s", - abspath(path)); + fullpathname(path)); goto error; } ad->ad_md->adf_flags |= O_CREAT; /* mark as just created */ @@ -752,7 +752,7 @@ static int ad_open_rf(const char *path, int adflags, int oflags, int mode, struc break; default: LOG(log_warning, logtype_default, "ad_open_rf(\"%s\"): %s", - abspath(path), strerror(errno)); + fullpathname(path), strerror(errno)); ret = -1; goto exit; } @@ -1091,13 +1091,13 @@ static int vad_open(struct adouble *ad, const char *path, int adflags, va_list a int mode = 0; LOG(log_debug, logtype_default, "ad_open(\"%s\", %s)", - abspath(path), adflags2logstr(adflags)); + fullpathname(path), adflags2logstr(adflags)); if (ad->ad_inited != AD_INITED) /* 1 */ AFP_PANIC("ad_open: not initialized"); if (ad->ad_fullpath == NULL) { /* 2 */ - if ((ad->ad_fullpath = bfromcstr(abspath(path))) == NULL) { + if ((ad->ad_fullpath = bfromcstr(fullpathname(path))) == NULL) { ret = -1; goto exit; } diff --git a/libatalk/compat/misc.c b/libatalk/compat/misc.c index cf11aeb4..dc4869e7 100644 --- a/libatalk/compat/misc.c +++ b/libatalk/compat/misc.c @@ -4,18 +4,6 @@ #include -#ifndef HAVE_STRNLEN -size_t strnlen(const char *s, size_t max) -{ - size_t len; - - for (len = 0; len < max; len++) { - if (s[len] == '\0') { - break; - } - } - return len; - #if !defined HAVE_DIRFD && defined SOLARIS #include int dirfd(DIR *dir) diff --git a/libatalk/dsi/dsi_cmdreply.c b/libatalk/dsi/dsi_cmdreply.c index 45798b09..eb8cfd38 100644 --- a/libatalk/dsi/dsi_cmdreply.c +++ b/libatalk/dsi/dsi_cmdreply.c @@ -12,7 +12,6 @@ #include #include -#include /* this assumes that the reply follows right after the command, saving * on a couple assignments. specifically, command, requestID, and diff --git a/libatalk/vfs/vfs.c b/libatalk/vfs/vfs.c index b33138bc..0eaacfae 100644 --- a/libatalk/vfs/vfs.c +++ b/libatalk/vfs/vfs.c @@ -505,33 +505,6 @@ static int validupath_ea(VFS_FUNC_ARGS_VALIDUPATH) /* ----------------- */ static int RF_chown_ea(VFS_FUNC_ARGS_CHOWN) { - mode_t file_mode = ad_hf_mode(mode); - mode_t dir_mode = file_mode; - struct set_mode param; - - if ((dir_mode & (S_IRUSR | S_IWUSR ))) - dir_mode |= S_IXUSR; - if ((dir_mode & (S_IRGRP | S_IWGRP ))) - dir_mode |= S_IXGRP; - if ((dir_mode & (S_IROTH | S_IWOTH ))) - dir_mode |= S_IXOTH; - - /* change folder */ - dir_mode |= DIRBITS; - if (dir_rx_set(dir_mode)) { - if (chmod_acl( name, dir_mode ) < 0) - return -1; - } - param.st = st; - param.mode = file_mode; - if (for_each_adouble("setfilmode_ads", name, ads_setfilmode_loop, ¶m, 0, v_umask) < 0) - return -1; - - if (!dir_rx_set(dir_mode)) { - if (chmod_acl( name, dir_mode ) < 0) - return -1; - } - return 0; } -- 2.39.2