aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2016-10-31 13:03:47 +0100
committerKarel Zak <kzak@redhat.com>2016-10-31 13:03:47 +0100
commit4a53290774b89f202aa5484fdd093426c28677aa (patch)
treecc03bcb984f8069c02d6c7a997065b2320137a51
parent391e675c6f92f4019b9b90bcb521399480580aad (diff)
parenteaaf0e7e378c3f0477008ac2da389c7e3b6652bd (diff)
downloadutil-linux-4a53290774b89f202aa5484fdd093426c28677aa.tar.gz
Merge branch 'fixes-for-v2.29' of https://github.com/rudimeier/util-linux
* 'fixes-for-v2.29' of https://github.com/rudimeier/util-linux: misc: once again some printf format strings misc: fix some compiler warnings chrt: fix HAVE_SCHED_SETATTR fallback case fdisk: fix memleak in list_disk_geometry()
-rw-r--r--disk-utils/fdisk-list.c4
-rw-r--r--libblkid/src/probe.c6
-rw-r--r--libblkid/src/read.c32
-rw-r--r--libblkid/src/superblocks/zfs.c6
-rw-r--r--libfdisk/src/item.c4
-rw-r--r--libsmartcols/samples/fromfile.c2
-rw-r--r--schedutils/chrt.c5
-rw-r--r--text-utils/pg.c8
8 files changed, 22 insertions, 45 deletions
diff --git a/disk-utils/fdisk-list.c b/disk-utils/fdisk-list.c
index 82216f09e5..e6b2033e77 100644
--- a/disk-utils/fdisk-list.c
+++ b/disk-utils/fdisk-list.c
@@ -75,8 +75,10 @@ void list_disk_geometry(struct fdisk_context *cxt)
fdisk_info(cxt, _("Disklabel type: %s"),
fdisk_label_get_name(lb));
- if (!fdisk_is_details(cxt) && fdisk_get_disklabel_id(cxt, &id) == 0 && id)
+ if (!fdisk_is_details(cxt) && fdisk_get_disklabel_id(cxt, &id) == 0 && id) {
fdisk_info(cxt, _("Disk identifier: %s"), id);
+ free(id);
+ }
}
void list_disklabel(struct fdisk_context *cxt)
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
index f2b3f93482..ea50f5a6b3 100644
--- a/libblkid/src/probe.c
+++ b/libblkid/src/probe.c
@@ -740,6 +740,8 @@ int blkid_probe_is_cdrom(blkid_probe pr)
return (pr->flags & BLKID_FL_CDROM_DEV);
}
+#ifdef CDROM_GET_CAPABILITY
+
static int is_sector_readable(int fd, uint64_t sector)
{
char buf[512];
@@ -754,7 +756,7 @@ static int is_sector_readable(int fd, uint64_t sector)
return 1;
failed:
- DBG(LOWPROBE, ul_debug("CDROM: read sector %ju failed %m", sector));
+ DBG(LOWPROBE, ul_debug("CDROM: read sector %"PRIu64" failed %m", sector));
errno = 0;
return 0;
}
@@ -785,6 +787,8 @@ failed:
pr->size = n << 9;
}
+#endif
+
/**
* blkid_probe_set_device:
* @pr: probe
diff --git a/libblkid/src/read.c b/libblkid/src/read.c
index c081baff54..42867735ff 100644
--- a/libblkid/src/read.c
+++ b/libblkid/src/read.c
@@ -32,11 +32,6 @@
# include <stdlib.h>
#endif
-#ifdef TEST_PROGRAM
-#define blkid_debug_dump_dev(dev) (debug_dump_dev(dev))
-static void debug_dump_dev(blkid_dev dev);
-#endif
-
/*
* File format:
*
@@ -377,8 +372,6 @@ static int blkid_parse_line(blkid_cache cache, blkid_dev *dev_p, char *cp)
goto done;
}
- /*DBG(READ, blkid_debug_dump_dev(dev));*/
-
done:
return ret;
}
@@ -452,31 +445,6 @@ errout:
}
#ifdef TEST_PROGRAM
-static void debug_dump_dev(blkid_dev dev)
-{
- struct list_head *p;
-
- if (!dev) {
- printf(" dev: NULL\n");
- return;
- }
-
- printf(" dev: name = %s\n", dev->bid_name);
- printf(" dev: DEVNO=\"0x%0llx\"\n", (long long)dev->bid_devno);
- printf(" dev: TIME=\"%ld.%ld\"\n", (long)dev->bid_time, (long)dev->bid_utime);
- printf(" dev: PRI=\"%d\"\n", dev->bid_pri);
- printf(" dev: flags = 0x%08X\n", dev->bid_flags);
-
- list_for_each(p, &dev->bid_tags) {
- blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
- if (tag)
- printf(" tag: %s=\"%s\"\n", tag->bit_name,
- tag->bit_val);
- else
- printf(" tag: NULL\n");
- }
- printf("\n");
-}
int main(int argc, char**argv)
{
diff --git a/libblkid/src/superblocks/zfs.c b/libblkid/src/superblocks/zfs.c
index c41f769905..02fa95675e 100644
--- a/libblkid/src/superblocks/zfs.c
+++ b/libblkid/src/superblocks/zfs.c
@@ -87,7 +87,7 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
memcpy(buff, p, sizeof(buff));
nvl = (struct nvlist *) buff;
- DBG(LOWPROBE, ul_debug("zfs_extract: nvlist offset %jd\n", offset));
+ DBG(LOWPROBE, ul_debug("zfs_extract: nvlist offset %jd\n", (intmax_t)offset));
nvp = &nvl->nvl_nvpair;
while (left > sizeof(*nvp) && nvp->nvp_size != 0 && found < 3) {
@@ -176,14 +176,14 @@ static int find_uberblocks(const void *label, loff_t *ub_offset, int *swap_endia
*ub_offset = offset;
*swap_endian = 0;
found++;
- DBG(LOWPROBE, ul_debug("probe_zfs: found little-endian uberblock at %jd\n", offset >> 10));
+ DBG(LOWPROBE, ul_debug("probe_zfs: found little-endian uberblock at %jd\n", (intmax_t)offset >> 10));
}
if (ub->ub_magic == swab_magic) {
*ub_offset = offset;
*swap_endian = 1;
found++;
- DBG(LOWPROBE, ul_debug("probe_zfs: found big-endian uberblock at %jd\n", offset >> 10));
+ DBG(LOWPROBE, ul_debug("probe_zfs: found big-endian uberblock at %jd\n", (intmax_t)offset >> 10));
}
}
diff --git a/libfdisk/src/item.c b/libfdisk/src/item.c
index 31637a1f1d..6c98228f49 100644
--- a/libfdisk/src/item.c
+++ b/libfdisk/src/item.c
@@ -1,4 +1,6 @@
+#include <inttypes.h>
+
#include "fdiskP.h"
/**
@@ -219,7 +221,7 @@ static int test_listitems(struct fdisk_test *ts, int argc, char *argv[])
&& fdisk_labelitem_get_data_string(item, &str) == 0)
printf("%s: %s\n", name, str);
else if (fdisk_labelitem_get_data_u64(item, &num) == 0)
- printf("%s: %ju\n", name, num);
+ printf("%s: %"PRIu64"\n", name, num);
break;
}
case 1: /* item unsuported by label -- ignore */
diff --git a/libsmartcols/samples/fromfile.c b/libsmartcols/samples/fromfile.c
index fcf01c7499..a2a22a4cdc 100644
--- a/libsmartcols/samples/fromfile.c
+++ b/libsmartcols/samples/fromfile.c
@@ -38,7 +38,7 @@ static const struct column_flag flags[] = {
{ "none", 0 }
};
-static long name_to_flag(const char *name, long unsigned int namesz)
+static long name_to_flag(const char *name, size_t namesz)
{
size_t i;
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 0a51c1088c..a861d9f75a 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -239,13 +239,14 @@ static void show_sched_pid_info(struct chrt_ctl *ctl, pid_t pid)
runtime = sa.sched_runtime;
period = sa.sched_period;
}
-#endif
/*
* Old way
*/
fallback:
- if (errno == ENOSYS) {
+ if (errno == ENOSYS)
+#endif
+ {
struct sched_param sp;
policy = sched_getscheduler(pid);
diff --git a/text-utils/pg.c b/text-utils/pg.c
index 142e3f1e95..ed62adcfde 100644
--- a/text-utils/pg.c
+++ b/text-utils/pg.c
@@ -46,7 +46,7 @@
#ifndef TIOCGWINSZ
# include <sys/ioctl.h>
#endif
-#include <sys/termios.h>
+#include <termios.h>
#include <fcntl.h>
#include <regex.h>
#include <stdio.h>
@@ -76,7 +76,7 @@
#define READBUF LINE_MAX /* size of input buffer */
#define CMDBUF 255 /* size of command buffer */
-#define TABSIZE 8 /* spaces consumed by tab character */
+#define PG_TABSIZE 8 /* spaces consumed by tab character */
#define cuc(c) ((c) & 0377)
@@ -417,7 +417,7 @@ static char *endline_for_mb(unsigned col, char *s)
goto ended;
/* Cursor right. */
case L'\t':
- pos += TABSIZE - (pos % TABSIZE);
+ pos += PG_TABSIZE - (pos % PG_TABSIZE);
break;
default:
if (iswprint(*p))
@@ -481,7 +481,7 @@ static char *endline(unsigned col, char *s)
goto cend;
/* Cursor right. */
case '\t':
- pos += TABSIZE - (pos % TABSIZE);
+ pos += PG_TABSIZE - (pos % PG_TABSIZE);
break;
default:
pos++;