Alok Aggarwal wrote:
> Please review the fix for the following bug -
> 6640490 lofiadm should not include zlib.h
> 
> Webrev:
> http://cr.opensolaris.org/~aalok/6640490/
> 
> Relatively straightforward, shouldn't take much
> time to review.
> 
> Thanks,
> Alok

Pardon my ignorance, but why are you doing this?  Lot's of applications are 
delivered in packages other than where libraries they use are located.

What your change does here is move the code that resolves the symbol to 
access the library into the application itself, when Solaris would have done 
that for you.  Also, you have now created a hard dependency on libz.so.1 
being in /usr/lib, as well as being named libz.so.1, where previously the 
Makefile handled the name and Solaris found where it was located for you.

In the gzip_compress() function you call die() if you can't locate the 
symbol compress2() in the library, or if you can't find the library.  I fail 
to see how that is different from Solaris reporting the same info and not 
running the program, unless it is that this routine is never invoked unless 
compression is requested, in which case an uncompressed volume would never 
see this error using your new code.

In a separate issue:

Looking at the code I see that gzip_compress() is used in a table: 
lofi_compress_table

The only place that is ever called is line 610:
  610         (void) li->l_compress(uncompressed_seg, rbytes,
  611             compressed_seg + SEGHDR, &real_segsize, li->l_level);

In gzip_compress() you are also returning either -1 or 0, depending on what 
calling calling compress2() via compress2p returns.  Yet in line 610 you are 
throwing that result away.  So the purpose of returning a 0 or -1 here is???

Mike

Reply via email to