From b6d8c035033b47e4e8aad7c852a08ff055b49d8c Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Wed, 19 Oct 2011 10:44:39 +0200 Subject: [PATCH 1/1] Fix an error when duplicating files that lacked an AppleDouble file which lead to a possible Finder crash --- NEWS | 2 ++ etc/afpd/file.c | 3 ++- libatalk/vfs/unix.c | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 375f0edc..fb95c3a5 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ Changes in 2.2.2 * UPD: afpd: Enhanced POSIX ACL mapping semantics, from Laura Mueller * FIX: afpd: ACL access checking +* FIX: afpd: Fix an error when duplicating files that lacked an AppleDouble file + which lead to a possible Finder crash * FIX: dbd: Better checking for duplicated or bogus CNIDs from AppleDouble files * FIX: Fix compilation error when AppleTalk support is disabled diff --git a/etc/afpd/file.c b/etc/afpd/file.c index ec85f37a..8402ebf1 100644 --- a/etc/afpd/file.c +++ b/etc/afpd/file.c @@ -1555,7 +1555,8 @@ int copyfile(const struct vol *s_vol, if (ad_reso_fileno(adp) == -1 || 0 == (err = copy_fork(ADEID_RFORK, &add, adp))){ /* copy the data fork */ if ((err = copy_fork(ADEID_DFORK, &add, adp)) == 0) { - err = d_vol->vfs->vfs_copyfile(d_vol, sfd, src, dst); + if (ad_meta_fileno(adp) != -1) + err = d_vol->vfs->vfs_copyfile(d_vol, sfd, src, dst); } } diff --git a/libatalk/vfs/unix.c b/libatalk/vfs/unix.c index 89c2ba1b..ffb524b8 100644 --- a/libatalk/vfs/unix.c +++ b/libatalk/vfs/unix.c @@ -192,13 +192,13 @@ int copy_file(int dirfd, const char *src, const char *dst, mode_t mode) sfd = open(src, O_RDONLY); #endif if (sfd < 0) { - LOG(log_error, logtype_afpd, "copy_file('%s'/'%s'): open '%s' error: %s", + LOG(log_info, logtype_afpd, "copy_file('%s'/'%s'): open '%s' error: %s", src, dst, src, strerror(errno)); return -1; } if ((dfd = open(dst, O_WRONLY | O_CREAT | O_TRUNC, mode)) < 0) { - LOG(log_error, logtype_afpd, "copy_file('%s'/'%s'): open '%s' error: %s", + LOG(log_info, logtype_afpd, "copy_file('%s'/'%s'): open '%s' error: %s", src, dst, dst, strerror(errno)); ret = -1; goto exit; -- 2.39.2