Skip to content
Commit 736bb118 authored by H. Nikolaus Schaller's avatar H. Nikolaus Schaller Committed by Masahiro Yamada
Browse files

modpost: remove use of non-standard strsep() in HOSTCC code

strsep() is neither standard C nor POSIX and used outside
the kernel code here. Using it here requires that the
build host supports it out of the box which is e.g.
not true for a Darwin build host and using a cross-compiler.
This leads to:

scripts/mod/modpost.c:145:2: warning: implicit declaration of function 'strsep' [-Wimplicit-function-declaration]
  return strsep(stringp, "\n");
  ^

and a segfault when running MODPOST.

See also: https://stackoverflow.com/a/7219504



So let's replace this by strchr() instead of using strsep().
It does not hurt kernel size or speed since this code is run
on the build host.

Fixes: ac5100f5 ("modpost: add read_text_file() and get_line() helpers")
Co-developed-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Signed-off-by: default avatarH. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent dcb7fd82
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment