The catblob commands are supposed to print this message only if none
of the given patterns matches any blob in the database. However, in
case all of the matching blobs are empty, we do print the message.
The problem is that the match count is not being increased due
to cat_blob() returning negative for empty blobs. This count is
computed in action_if_pattern_matches() which calls cat_blob() as
its action handler which in turn calls osl_open_disk_object(). But
this function returns -E_OSL_EMPTY for empty blobs, and cat_blob()
just passes through this value.
This patch changes cat_blob() so that it explicitly checks for
-E_OSL_EMPTY and returns zero in this case so that the match counter
will be increased.
ret = osl(osl_open_disk_object(table, row, BLOBCOL_DEF, &obj));
if (ret < 0)
- return ret;
- if (obj.size)
- ret = pass_buffer_as_shm(obj.data, obj.size, data);
+ return (ret == osl(-E_OSL_EMPTY))? 0 : ret;
+ assert(obj.size > 0);
+ ret = pass_buffer_as_shm(obj.data, obj.size, data);
ret2 = osl(osl_close_disk_object(&obj));
return (ret < 0)? ret : ret2;
}