summaryrefslogtreecommitdiff
path: root/src/df.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-03-31 17:59:16 +0200
committerJim Meyering <meyering@redhat.com>2011-04-03 21:55:27 +0200
commit03583f8d646f4cc4d5f91b7ed763c147a00e2f44 (patch)
treee75e865b606e1fd762b53fa0d1240f619a4338a4 /src/df.c
parent1c3654cb1fb0d8f3c422c766028d0783a40f4a42 (diff)
downloadcoreutils-03583f8d646f4cc4d5f91b7ed763c147a00e2f44.tar.xz
maint: prohibit direct use of strncmp: prefer STREQ_LEN, STRNCMP_LIT
* cfg.mk (sc_prohibit_strncmp): New rule, mostly from libvirt. * src/system.h (STREQ_LEN, STRPREFIX, STRNCMP_LIT): Define. * src/df.c (get_dev, get_point): Convert. * src/extent-scan.c (extent_need_sync): Likewise. * src/ls.c (is_colored, decode_switches): Likewise. (parse_ls_color, (print_color_indicator): Likewise. * src/md5sum.c (split_3): Likewise. * src/split.c (main, emit_ancillary_info): Likewise. * src/tr.c (look_up_char_class): Likewise. * src/uname.c (main): Likewise. * src/who.c (scan_entries): Likewise.
Diffstat (limited to 'src/df.c')
-rw-r--r--src/df.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/df.c b/src/df.c
index 357dca547..14f07905d 100644
--- a/src/df.c
+++ b/src/df.c
@@ -611,9 +611,9 @@ get_dev (char const *disk, char const *mount_point,
/* Don't print the first directory name in MOUNT_POINT if it's an
artifact of an automounter. This is a bit too aggressive to be
the default. */
- if (strncmp ("/auto/", mount_point, 6) == 0)
+ if (STRNCMP_LIT (mount_point, "/auto/") == 0)
mount_point += 5;
- else if (strncmp ("/tmp_mnt/", mount_point, 9) == 0)
+ else if (STRNCMP_LIT (mount_point, "/tmp_mnt/") == 0)
mount_point += 8;
#endif
cell = xstrdup (mount_point);
@@ -682,7 +682,7 @@ get_point (const char *point, const struct stat *statp)
if (best_match_len <= len && len <= resolved_len
&& (len == 1 /* root file system */
|| ((len == resolved_len || resolved[len] == '/')
- && strncmp (me->me_mountdir, resolved, len) == 0)))
+ && STREQ_LEN (me->me_mountdir, resolved, len))))
{
best_match = me;
best_match_len = len;