← Commit list

fd5e66eb8

Denys Vlasenko
Denys Vlasenko
2017-07-21
FAILED Duration: 31s

Subject

basename: do not use argc

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

coreutils/basename.c+4 -5
@@ -47,25 +47,24 @@
/* This is a NOFORK applet. Be very careful! */
int basename_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int basename_main(int argc, char **argv)
+int basename_main(int argc UNUSED_PARAM, char **argv)
{
size_t m, n;
char *s;
if (argv[1] && strcmp(argv[1], "--") == 0) {
argv++;
- argc--;
}
-
- if ((unsigned)(argc-2) >= 2) {
+ if (!argv[1])
bb_show_usage();
- }
/* It should strip slash: /abc/def/ -> def */
s = bb_get_last_path_component_strip(*++argv);
m = strlen(s);
if (*++argv) {
+ if (argv[1])
+ bb_show_usage();
n = strlen(*argv);
if ((m > n) && (strcmp(s+m-n, *argv) == 0)) {
m -= n;