From: Frank Lahm Date: Tue, 25 Jan 2011 13:00:34 +0000 (+0100) Subject: Fixes X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=158a5d862d6aba7bdf6e05028efbab9e2c04a394;hp=5cd37c15decf5edd7b1bcde5f437a35ba586202b;p=netatalk.git Fixes --- diff --git a/etc/afpd/file.c b/etc/afpd/file.c index e827134a..70657706 100644 --- a/etc/afpd/file.c +++ b/etc/afpd/file.c @@ -1121,8 +1121,7 @@ int renamefile(const struct vol *vol, int sdir_fd, char *src, char *dst, char *n } } - /* don't care if we can't open the newly renamed ressource fork - */ + /* don't care if we can't open the newly renamed ressource fork */ if (ad_open(adp, dst, ADFLAGS_HF, O_RDWR) == 0) { ad_setname(adp, newname); ad_flush( adp ); diff --git a/etc/afpd/filedir.c b/etc/afpd/filedir.c index 9ec0271a..47b819f9 100644 --- a/etc/afpd/filedir.c +++ b/etc/afpd/filedir.c @@ -380,6 +380,7 @@ static int moveandrename(const struct vol *vol, u_int16_t bshort; ad_getattr(adp, &bshort); + ad_close_metadata( adp); if ((bshort & htons(ATTRBIT_NORENAME))) { rc = AFPERR_OLOCK; diff --git a/include/atalk/adouble.h b/include/atalk/adouble.h index 60032780..eac8be14 100644 --- a/include/atalk/adouble.h +++ b/include/atalk/adouble.h @@ -43,6 +43,7 @@ #include #include +#include /* version info */ #define AD_VERSION2 0x00020000 diff --git a/include/atalk/locking.h b/include/atalk/locking.h index 5f88d88e..e1c1303a 100644 --- a/include/atalk/locking.h +++ b/include/atalk/locking.h @@ -13,13 +13,14 @@ #include #include -#include #include #include "event2/event.h" #include "event2/http.h" #include "event2/rpc.h" +struct adouble; + extern int rpc_init(const char *addr, unsigned short port); extern int rpc_lock(struct adouble *, uint32_t eid, int type, off_t off, off_t len, int user); extern void rpc_unlock(struct adouble *, int user); diff --git a/libatalk/adouble/ad_flush.c b/libatalk/adouble/ad_flush.c index 9c9c3891..3af59d90 100644 --- a/libatalk/adouble/ad_flush.c +++ b/libatalk/adouble/ad_flush.c @@ -184,16 +184,13 @@ int ad_flush(struct adouble *ad) * Close a struct adouble freeing all resources * * This close the whole thing, regardless of what you pass in adflags! + * When open forks are using this struct adouble (ad_refcount>0) the close + * request is ignored. */ int ad_close( struct adouble *ad, int adflags) { int err = 0; - if (ad->ad_inited == AD_CLOSED) { - LOG(log_warning, logtype_default, "ad_close: double close"); - return 0; - } - LOG(log_debug, logtype_default, "ad_close(\"%s\", %s)", cfrombstr(ad->ad_fullpath), adflags2logstr(adflags)); @@ -236,7 +233,5 @@ int ad_close( struct adouble *ad, int adflags) ad->ad_fullpath = NULL; } - ad->ad_inited = AD_CLOSED; - return err; } diff --git a/libatalk/rpc/locking.c b/libatalk/rpc/locking.c index 0aedaf53..6916e07d 100644 --- a/libatalk/rpc/locking.c +++ b/libatalk/rpc/locking.c @@ -17,6 +17,8 @@ #include "event2/event.h" #include "event2/http.h" +#include "event2/event_compat.h" +#include "event2/http_compat.h" #include "event2/rpc.h" #include "event2/rpc_struct.h" @@ -62,7 +64,8 @@ static void rpc_dummy(const char *name) EVRPC_MAKE_REQUEST(lock_msg, rpc_pool, lock_req, lock_rep, msg_rep_cb, NULL); - event_base_dispatch(ev_base); +// event_base_dispatch(ev_base); + event_dispatch(); } int rpc_lock(struct adouble *ad, uint32_t eid, int type, off_t off, off_t len, int user) @@ -89,13 +92,14 @@ int rpc_tmplock(struct adouble *ad, uint32_t eid, int type, off_t off, off_t len int rpc_init(const char *addr, unsigned short port) { EC_INIT; - struct evhttp_connection *evcon; + struct evhttp_connection *evcon; - EC_NULL_LOG(ev_base = event_base_new()); +// EC_NULL_LOG(ev_base = event_base_new()); event_set_log_callback(ev_log_cb); - EC_NULL_LOG(rpc_pool = evrpc_pool_new(ev_base)); - EC_NULL_LOG(evcon = evhttp_connection_base_new(NULL, NULL, addr, port)); - +// EC_NULL_LOG(rpc_pool = evrpc_pool_new(ev_base)); + EC_NULL_LOG(rpc_pool = evrpc_pool_new(NULL)); +// EC_NULL_LOG(evcon = evhttp_connection_new(addr, port)); + EC_NULL_LOG(evcon = evhttp_connection_new(addr, port)); evrpc_pool_add_connection(rpc_pool, evcon); EC_CLEANUP: