diff options
| author | jrgn.keil@googlemail.com <none@none> | 2009-03-16 15:15:29 -0600 |
|---|---|---|
| committer | jrgn.keil@googlemail.com <none@none> | 2009-03-16 15:15:29 -0600 |
| commit | 4058a205f4dc02b0401f5e26077e834cd2ca99ef (patch) | |
| tree | c87be8000a96ddb16860254cc3c52cd094aa65fb /usr/src/cmd/lofiadm | |
| parent | 4ba491f53199ecfd5a928fdce7dc8f8aa9de4b9e (diff) | |
| download | illumos-joyent-4058a205f4dc02b0401f5e26077e834cd2ca99ef.tar.gz | |
Contributed by Juergen Keil <jrgn.keil@googlemail.com>
6679115 lofi(7) shouldn't accept non-powers of 2 for a segment size
6805505 lofi needs a performance boost
Diffstat (limited to 'usr/src/cmd/lofiadm')
| -rw-r--r-- | usr/src/cmd/lofiadm/main.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr/src/cmd/lofiadm/main.c b/usr/src/cmd/lofiadm/main.c index 1ba161213c..63dda817f6 100644 --- a/usr/src/cmd/lofiadm/main.c +++ b/usr/src/cmd/lofiadm/main.c @@ -34,6 +34,7 @@ #include <sys/param.h> #include <sys/lofi.h> #include <sys/stat.h> +#include <sys/sysmacros.h> #include <netinet/in.h> #include <stdio.h> #include <fcntl.h> @@ -1539,7 +1540,8 @@ lofi_compress(int *lfd, const char *filename, int compress_index, * ensures that that segment is left uncompressed. */ len_compressed = real_segsize; - if (real_segsize > segsize - COMPRESS_THRESHOLD) { + if (segsize <= COMPRESS_THRESHOLD || + real_segsize > (segsize - COMPRESS_THRESHOLD)) { (void) memcpy(compressed_seg + SEGHDR, uncompressed_seg, rbytes); type = UNCOMPRESSED; @@ -1861,7 +1863,7 @@ main(int argc, char *argv[]) break; case 's': segsize = convert_to_num(optarg); - if (segsize == 0 || segsize % DEV_BSIZE) + if (segsize < DEV_BSIZE || !ISP2(segsize)) die(gettext("segment size %s is invalid " "or not a multiple of minimum block " "size %ld\n"), optarg, DEV_BSIZE); |
