]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - attribute.c
afs: Introduce flush_and_free_pb().
[paraslash.git] / attribute.c
index 435f22b5aed560f134aae6b2c9520789c39c3b36..0c23addf3228fb753f5ded3b49dafb45f4d5823e 100644 (file)
@@ -178,9 +178,7 @@ static void com_lsatt_callback(int fd, const struct osl_object *query)
        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);
 }
 
 int com_lsatt(struct command_context *cc)
@@ -286,9 +284,7 @@ static void com_addatt_callback(int fd, const struct osl_object *query)
 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);
 }
 
 int com_addatt(struct command_context *cc)
@@ -332,9 +328,7 @@ out:
                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);
 }
 
 int com_mvatt(struct command_context *cc)
@@ -412,9 +406,7 @@ static void com_rmatt_callback(int fd, const struct osl_object *query)
                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);
 }
 
 int com_rmatt(struct command_context *cc)