struct osl_object bitnum_obj;
int ret;
- if (!(laad->flags & LSATT_FLAG_LONG))
- return para_printf(&laad->pb, "%s\n", name);
+ if (!(laad->flags & LSATT_FLAG_LONG)) {
+ para_printf(&laad->pb, "%s\n", name);
+ return 1;
+ }
ret = osl(osl_get_object(table, row, ATTCOL_BITNUM, &bitnum_obj));
if (ret < 0) {
para_printf(&laad->pb, "%s: %s\n", name, para_strerror(-ret));
return ret;
}
- return para_printf(&laad->pb, "%u\t%s\n", *(unsigned char*)bitnum_obj.data,
+ para_printf(&laad->pb, "%u\t%s\n", *(unsigned char*)bitnum_obj.data,
name);
+ return 1;
}
static void com_lsatt_callback(int fd, const struct osl_object *query)
static void com_addatt_callback(int fd, const struct osl_object *query)
{
char *p;
- int ret = 1, ret2 = 0;
+ int ret = 1;
struct para_buffer pb = {
.max_size = shm_get_shmmax(),
.private_data = &(struct afs_max_size_handler_data) {
len = strlen(p);
if (!len || p[len - 1] == '-' || p[len - 1] == '+') {
- ret2 = para_printf(&pb, "invalid attribute name: %s\n", p);
- if (ret2 < 0)
- goto out;
+ para_printf(&pb, "invalid attribute name: %s\n", p);
continue;
}
ret = get_attribute_bitnum_by_name(p, &bitnum);
if (ret >= 0) {
- ret2 = para_printf(&pb, "attribute \"%s\" already exists\n", p);
- if (ret2 < 0)
- goto out;
+ para_printf(&pb, "attribute \"%s\" already exists\n", p);
continue;
}
if (ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND)) /* error */
greatest_att_bitnum = PARA_MAX(greatest_att_bitnum, (int)bitnum);
}
out:
- if (ret < 0 && ret2 >= 0)
+ if (ret < 0)
para_printf(&pb, "%s: %s\n", p, para_strerror(-ret));
if (pb.offset)
pass_buffer_as_shm(fd, SBD_OUTPUT, pb.buf, pb.offset);
uint64_t mask_of_removed_atts;
};
+/* returns succcess even on errors to keep the loop going */
static int remove_attribute(struct osl_table *table, struct osl_row *row,
const char *name, void *data)
{
struct rmatt_event_data red = {.name = name};
ret = get_attribute_bitnum_by_name(name, &red.bitnum);
- if (ret < 0)
- return para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
+ if (ret < 0) {
+ para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
+ return 0;
+ }
ret = osl(osl_del_row(table, row));
- if (ret < 0)
- return para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
- ret = para_printf(&raad->pb, "removed attribute %s\n", name);
+ if (ret < 0) {
+ para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
+ return 0;
+ }
+ para_printf(&raad->pb, "removed attribute %s\n", name);
raad->num_removed++;
raad->mask_of_removed_atts |= (1 << red.bitnum);
afs_event(ATTRIBUTE_REMOVE, &raad->pb, &red);
- return ret;
+ return 1;
}
static void com_rmatt_callback(int fd, const struct osl_object *query)
.max_size_handler = afs_max_size_handler,
}
};
- int ret, ret2 = 0;
+ int ret;
struct pattern_match_data pmd = {
.table = attribute_table,
.patterns = *query,
};
ret = for_each_matching_row(&pmd);
if (ret < 0)
- ret2 = para_printf(&raad.pb, "%s\n", para_strerror(-ret));
+ para_printf(&raad.pb, "%s\n", para_strerror(-ret));
else if (!raad.num_removed)
- ret2 = para_printf(&raad.pb, "no match -- nothing removed\n");
- if (ret2 >= 0 && raad.pb.offset)
+ para_printf(&raad.pb, "no match -- nothing removed\n");
+ if (raad.pb.offset)
pass_buffer_as_shm(fd, SBD_OUTPUT, raad.pb.buf, raad.pb.offset);
free(raad.pb.buf);
}