X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=attribute.c;h=e0e9a2fa96e1c3817434c0d060b49d9117486de3;hp=70e35ae58f572308cb1a4a32266e122007e5a05c;hb=46456d9c78c489708f63f5d44894e42f137dd535;hpb=a3ea3e74e59bc6cff452542ff9b422af647c189d diff --git a/attribute.c b/attribute.c index 70e35ae5..e0e9a2fa 100644 --- a/attribute.c +++ b/attribute.c @@ -364,12 +364,12 @@ static int remove_attribute(struct osl_table *table, struct osl_row *row, ret = get_attribute_bitnum_by_name(name, &red.bitnum); if (ret < 0) { para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret)); - return 0; + return ret; } ret = osl(osl_del_row(table, row)); if (ret < 0) { para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret)); - return 0; + return ret; } para_printf(&raad->pb, "removed attribute %s\n", name); raad->num_removed++; @@ -401,25 +401,23 @@ static int com_rmatt_callback(int fd, const struct osl_object *query) .action = remove_attribute }; ret = for_each_matching_row(&pmd); - if (ret < 0) + if (ret < 0) { para_printf(&raad.pb, "%s\n", para_strerror(-ret)); - else if (!raad.num_removed) - para_printf(&raad.pb, "no match -- nothing removed\n"); + goto out; + } + if (!raad.num_removed) + ret = -E_NO_MATCH; +out: flush_and_free_pb(&raad.pb); - return 0; + return ret; } int com_rmatt(struct command_context *cc) { - int ret; - if (cc->argc < 2) return -E_ATTR_SYNTAX; - ret = send_standard_callback_request(cc->argc - 1, cc->argv + 1, + return send_standard_callback_request(cc->argc - 1, cc->argv + 1, com_rmatt_callback, afs_cb_result_handler, cc); - if (ret < 0) - send_strerror(cc, -ret); - return ret; } /**