return 1;
}
-static void com_lsatt_callback(int fd, const struct osl_object *query)
+static int com_lsatt_callback(int fd, const struct osl_object *query)
{
struct lsatt_action_data laad = {
.flags = *(unsigned *) query->data,
if (laad.flags & LSATT_FLAG_REVERSE)
pmd.pm_flags |= PM_REVERSE_LOOP;
for_each_matching_row(&pmd);
- if (laad.pb.offset)
- pass_buffer_as_shm(fd, SBD_OUTPUT, laad.pb.buf, laad.pb.offset);
- free(laad.pb.buf);
+ flush_and_free_pb(&laad.pb);
+ return 0;
}
int com_lsatt(struct command_context *cc)
};
-static void com_addatt_callback(int fd, const struct osl_object *query)
+static int com_addatt_callback(int fd, const struct osl_object *query)
{
char *p;
int ret = 1;
out:
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);
- free(pb.buf);
+ flush_and_free_pb(&pb);
+ return 0;
}
int com_addatt(struct command_context *cc)
return ret;
}
-static void com_mvatt_callback(int fd, const struct osl_object *query)
+static int com_mvatt_callback(int fd, const struct osl_object *query)
{
char *old = query->data;
size_t size = strlen(old) + 1;
para_printf(&pb, "%s\n", para_strerror(-ret));
else
afs_event(ATTRIBUTE_RENAME, &pb, NULL);
- if (pb.offset)
- pass_buffer_as_shm(fd, SBD_OUTPUT, pb.buf, pb.offset);
- free(pb.buf);
+ flush_and_free_pb(&pb);
+ return 0;
}
int com_mvatt(struct command_context *cc)
return 1;
}
-static void com_rmatt_callback(int fd, const struct osl_object *query)
+static int com_rmatt_callback(int fd, const struct osl_object *query)
{
struct remove_attribute_action_data raad = {
.num_removed = 0,
para_printf(&raad.pb, "%s\n", para_strerror(-ret));
else if (!raad.num_removed)
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);
+ flush_and_free_pb(&raad.pb);
+ return 0;
}
int com_rmatt(struct command_context *cc)