From: Ralph Boehme Date: Thu, 4 Oct 2018 06:23:59 +0000 (+0200) Subject: vfs_fruit: do direct return from error checks in ad_convert() X-Git-Tag: tdb-1.3.17~1358 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bc36d723ff41afe768f42b833aa951e1ee8fb38;p=thirdparty%2Fsamba.git vfs_fruit: do direct return from error checks in ad_convert() Subsequent commits will move the mmap() into the subfunctions. This change just prepares for that. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13649 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 2dec9089006..7d544ea7f94 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -1081,8 +1081,7 @@ static int ad_convert(struct adouble *ad, map = mmap(NULL, origlen, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); if (map == MAP_FAILED) { DEBUG(2, ("mmap AppleDouble: %s\n", strerror(errno))); - rc = -1; - goto exit; + return -1; } ok = ad_convert_xattr(ad, smb_fname, map); @@ -1106,12 +1105,18 @@ static int ad_convert(struct adouble *ad, */ rc = ftruncate(fd, ad_getentryoff(ad, ADEID_RFORK) + ad_getentrylen(ad, ADEID_RFORK)); - -exit: - if (map != MAP_FAILED) { + if (rc != 0) { munmap(map, origlen); + return -1; } - return rc; + + rc = munmap(map, origlen); + if (rc != 0) { + DBG_ERR("munmap failed: %s\n", strerror(errno)); + return -1; + } + + return 0; } /**