8000 libblkid: avoid strcasecmp() for ASCII-only strings · util-linux/util-linux@41a6df7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 41a6df7

Browse files
committed
libblkid: avoid strcasecmp() for ASCII-only strings
Use cctype.h for locale-independent string comparison and to avoid tricky string conversions like in tr_TR locales. Signed-off-by: Karel Zak <kzak@redhat.com> (cherry picked from commit 7eb6635)
1 parent e6a7001 commit 41a6df7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

libblkid/src/config.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include "blkidP.h"
3131
#include "env.h"
32+
#include "cctype.h"
3233

3334
static int parse_evaluate(struct blkid_config *conf, char *s)
3435
{
@@ -94,7 +95,7 @@ static int parse_next(FILE *fd, struct blkid_config *conf)
9495

9596
if (!strncmp(s, "SEND_UEVENT=", 12)) {
9697
s += 12;
97-
if (*s && !strcasecmp(s, "yes"))
98+
if (*s && !c_strcasecmp(s, "yes"))
9899
conf->uevent = TRUE;
99100
else if (*s)
100101
conf->uevent = FALSE;

libblkid/src/partitions/partitions.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "partitions.h"
2424
#include "sysfs.h"
2525
#include "strutils.h"
26+
#include "cctype.h"
2627

2728
/**
2829
* SECTION: partitions
@@ -1044,7 +1045,7 @@ blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno
10441045
tmp = uuid;
10451046
prefix = uuid ? strsep(&tmp, "-") : NULL;
10461047

1047-
if (prefix && strncasecmp(prefix, "part", 4) == 0) {
1048+
if (prefix && c_strncasecmp(prefix, "part", 4) == 0) {
10481049
char *end = NULL;
10491050

10501051
errno = 0;

0 commit comments

Comments
 (0)
0