diff options
-rw-r--r-- | include/platform.h | 2 | ||||
-rw-r--r-- | libbb/sha1.c | 22 | ||||
-rw-r--r-- | util-linux/fdisk_osf.c | 5 | ||||
-rw-r--r-- | util-linux/mkfs_vfat.c | 3 |
4 files changed, 18 insertions, 14 deletions
diff --git a/include/platform.h b/include/platform.h index 54bc27d5b..8ed05a4ad 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -324,7 +324,7 @@ typedef unsigned smalluint; | |||
324 | # include <inttypes.h> | 324 | # include <inttypes.h> |
325 | # define PRIu32 "u" | 325 | # define PRIu32 "u" |
326 | /* use legacy setpgrp(pid_t,pid_t) for now. move to platform.c */ | 326 | /* use legacy setpgrp(pid_t,pid_t) for now. move to platform.c */ |
327 | # define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me,__me); } while (0) | 327 | # define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me, __me); } while (0) |
328 | # if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET | 328 | # if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET |
329 | # define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET) | 329 | # define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET) |
330 | # endif | 330 | # endif |
diff --git a/libbb/sha1.c b/libbb/sha1.c index ea645b735..5f42532cd 100644 --- a/libbb/sha1.c +++ b/libbb/sha1.c | |||
@@ -408,7 +408,7 @@ void FAST_FUNC sha512_hash(const void *buffer, size_t len, sha512_ctx_t *ctx) | |||
408 | /* Used also for sha256 */ | 408 | /* Used also for sha256 */ |
409 | void FAST_FUNC sha1_end(void *resbuf, sha1_ctx_t *ctx) | 409 | void FAST_FUNC sha1_end(void *resbuf, sha1_ctx_t *ctx) |
410 | { | 410 | { |
411 | unsigned i, pad, in_buf; | 411 | unsigned pad, in_buf; |
412 | 412 | ||
413 | in_buf = ctx->total64 & 63; | 413 | in_buf = ctx->total64 & 63; |
414 | /* Pad the buffer to the next 64-byte boundary with 0x80,0,0,0... */ | 414 | /* Pad the buffer to the next 64-byte boundary with 0x80,0,0,0... */ |
@@ -434,16 +434,17 @@ void FAST_FUNC sha1_end(void *resbuf, sha1_ctx_t *ctx) | |||
434 | 434 | ||
435 | in_buf = (ctx->process_block == sha1_process_block64) ? 5 : 8; | 435 | in_buf = (ctx->process_block == sha1_process_block64) ? 5 : 8; |
436 | /* This way we do not impose alignment constraints on resbuf: */ | 436 | /* This way we do not impose alignment constraints on resbuf: */ |
437 | #if BB_LITTLE_ENDIAN | 437 | if (BB_LITTLE_ENDIAN) { |
438 | for (i = 0; i < in_buf; ++i) | 438 | unsigned i; |
439 | ctx->hash[i] = htonl(ctx->hash[i]); | 439 | for (i = 0; i < in_buf; ++i) |
440 | #endif | 440 | ctx->hash[i] = htonl(ctx->hash[i]); |
441 | } | ||
441 | memcpy(resbuf, ctx->hash, sizeof(ctx->hash[0]) * in_buf); | 442 | memcpy(resbuf, ctx->hash, sizeof(ctx->hash[0]) * in_buf); |
442 | } | 443 | } |
443 | 444 | ||
444 | void FAST_FUNC sha512_end(void *resbuf, sha512_ctx_t *ctx) | 445 | void FAST_FUNC sha512_end(void *resbuf, sha512_ctx_t *ctx) |
445 | { | 446 | { |
446 | unsigned i, pad, in_buf; | 447 | unsigned pad, in_buf; |
447 | 448 | ||
448 | in_buf = ctx->total64[0] & 127; | 449 | in_buf = ctx->total64[0] & 127; |
449 | /* Pad the buffer to the next 128-byte boundary with 0x80,0,0,0... | 450 | /* Pad the buffer to the next 128-byte boundary with 0x80,0,0,0... |
@@ -470,9 +471,10 @@ void FAST_FUNC sha512_end(void *resbuf, sha512_ctx_t *ctx) | |||
470 | break; | 471 | break; |
471 | } | 472 | } |
472 | 473 | ||
473 | #if BB_LITTLE_ENDIAN | 474 | if (BB_LITTLE_ENDIAN) { |
474 | for (i = 0; i < ARRAY_SIZE(ctx->hash); ++i) | 475 | unsigned i; |
475 | ctx->hash[i] = hton64(ctx->hash[i]); | 476 | for (i = 0; i < ARRAY_SIZE(ctx->hash); ++i) |
476 | #endif | 477 | ctx->hash[i] = hton64(ctx->hash[i]); |
478 | } | ||
477 | memcpy(resbuf, ctx->hash, sizeof(ctx->hash)); | 479 | memcpy(resbuf, ctx->hash, sizeof(ctx->hash)); |
478 | } | 480 | } |
diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c index 09a68da83..b89a2b2af 100644 --- a/util-linux/fdisk_osf.c +++ b/util-linux/fdisk_osf.c | |||
@@ -615,7 +615,7 @@ xbsd_create_disklabel(void) | |||
615 | 615 | ||
616 | while (1) { | 616 | while (1) { |
617 | c = read_nonempty("Do you want to create a disklabel? (y/n) "); | 617 | c = read_nonempty("Do you want to create a disklabel? (y/n) "); |
618 | if (c == 'y' || c == 'Y') { | 618 | if ((c|0x20) == 'y') { |
619 | if (xbsd_initlabel( | 619 | if (xbsd_initlabel( |
620 | #if defined(__alpha__) || defined(__powerpc__) || defined(__hppa__) || \ | 620 | #if defined(__alpha__) || defined(__powerpc__) || defined(__hppa__) || \ |
621 | defined(__s390__) || defined(__s390x__) | 621 | defined(__s390__) || defined(__s390x__) |
@@ -629,7 +629,7 @@ xbsd_create_disklabel(void) | |||
629 | } | 629 | } |
630 | return 0; | 630 | return 0; |
631 | } | 631 | } |
632 | if (c == 'n') | 632 | if ((c|0x20) == 'n') |
633 | return 0; | 633 | return 0; |
634 | } | 634 | } |
635 | } | 635 | } |
@@ -964,6 +964,7 @@ xbsd_writelabel(struct partition *p) | |||
964 | #if !defined(__alpha__) && !defined(__powerpc__) && !defined(__hppa__) | 964 | #if !defined(__alpha__) && !defined(__powerpc__) && !defined(__hppa__) |
965 | sector = get_start_sect(p) + BSD_LABELSECTOR; | 965 | sector = get_start_sect(p) + BSD_LABELSECTOR; |
966 | #else | 966 | #else |
967 | (void)p; /* silence warning */ | ||
967 | sector = BSD_LABELSECTOR; | 968 | sector = BSD_LABELSECTOR; |
968 | #endif | 969 | #endif |
969 | 970 | ||
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c index de88a7443..e794b3145 100644 --- a/util-linux/mkfs_vfat.c +++ b/util-linux/mkfs_vfat.c | |||
@@ -471,7 +471,8 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv) | |||
471 | strcpy(boot_blk->boot_jump, "\xeb\x58\x90" "mkdosfs"); // system_id[8] included :) | 471 | strcpy(boot_blk->boot_jump, "\xeb\x58\x90" "mkdosfs"); // system_id[8] included :) |
472 | STORE_LE(boot_blk->bytes_per_sect, bytes_per_sect); | 472 | STORE_LE(boot_blk->bytes_per_sect, bytes_per_sect); |
473 | STORE_LE(boot_blk->sect_per_clust, sect_per_clust); | 473 | STORE_LE(boot_blk->sect_per_clust, sect_per_clust); |
474 | STORE_LE(boot_blk->reserved_sect, reserved_sect); | 474 | // cast in needed on big endian to suppress a warning |
475 | STORE_LE(boot_blk->reserved_sect, (uint16_t)reserved_sect); | ||
475 | STORE_LE(boot_blk->fats, 2); | 476 | STORE_LE(boot_blk->fats, 2); |
476 | //STORE_LE(boot_blk->dir_entries, 0); // for FAT32, stays 0 | 477 | //STORE_LE(boot_blk->dir_entries, 0); // for FAT32, stays 0 |
477 | if (volume_size_sect <= 0xffff) | 478 | if (volume_size_sect <= 0xffff) |