X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=afs.c;h=263f1818a2763522fd04bacbc153ccdaffce1f35;hp=b4c85dcb82eb2061501c2567005f66015b30b6f0;hb=0cbd0ac87ebe208b0d47df28e86c16886bdb687d;hpb=8aa0f575bcca12ab63ab53141c2144448c457478 diff --git a/afs.c b/afs.c index b4c85dcb..263f1818 100644 --- a/afs.c +++ b/afs.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 Andre Noll + * Copyright (C) 2007-2012 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -192,7 +192,7 @@ static int dispatch_result(int result_shmid, callback_result_handler *handler, * shmid are passed to that function as an osl object. The private_result_data * pointer is passed as the second argument to \a result_handler. * - * \return Standard. + * \return Number of shared memory areas dispatched on success, negative on errors. * * \sa send_option_arg_callback_request(), send_standard_callback_request(). */ @@ -205,7 +205,7 @@ int send_callback_request(callback_function *f, struct osl_object *query, void *query_shm; char buf[sizeof(afs_socket_cookie) + sizeof(int)]; size_t query_shm_size = sizeof(*cq); - int dispatch_error = 0; + int dispatch_error = 0, num_dispatched = 0; if (query) query_shm_size += query->size; @@ -261,6 +261,7 @@ int send_callback_request(callback_function *f, struct osl_object *query, if (ret < 0) PARA_CRIT_LOG("destroy result failed: %s\n", para_strerror(-ret)); + num_dispatched++; } out: if (shm_destroy(query_shmid) < 0) @@ -268,7 +269,7 @@ out: if (fd >= 0) close(fd); // PARA_DEBUG_LOG("callback_ret: %d\n", ret); - return ret; + return ret < 0? ret : num_dispatched; } /** @@ -363,7 +364,10 @@ static int action_if_pattern_matches(struct osl_row *row, void *data) continue; if (ret) return -E_FNMATCH; - return pmd->action(pmd->table, row, name, pmd->data); + ret = pmd->action(pmd->table, row, name, pmd->data); + if (ret >= 0) + pmd->num_matches++; + return ret; } return 1; } @@ -1046,7 +1050,8 @@ int com_init(struct stream_cipher_context *scc, int argc, char * const * const a ret = send_callback_request(create_tables_callback, &query, sc_send_result, scc); if (ret < 0) - return sc_send_va_buffer(scc, "%s\n", para_strerror(-ret)); + /* ignore return value */ + sc_send_va_buffer(scc, "%s\n", para_strerror(-ret)); return ret; }