← Commit list

cf2600c36

Denys Vlasenko
Denys Vlasenko
2016-12-03
SUCCESS Duration: 266s

Subject

install: fix musl problem with dirname

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/install.c+10 -3
@@ -209,9 +209,16 @@ int install_main(int argc, char **argv)
dest = last;
if (opts & OPT_MKDIR_LEADING) {
char *ddir = xstrdup(dest);
- bb_make_directory(dirname(ddir), 0755, mkdir_flags);
- /* errors are not checked. copy_file
- * will fail if dir is not created. */
+ char *dn = dirname(ddir);
+ /* musl can return read-only "/" or "." string.
+ * bb_make_directory needs writable string.
+ */
+ if ((dn[0] != '/' && dn[0] != '.') || dn[1] != '\0') {
+ bb_make_directory(dn, 0755, mkdir_flags);
+ /* errors are not checked. copy_file
+ * will fail if dir is not created.
+ */
+ }
free(ddir);
}
if (isdir)