Replace the usage of non-standard GNU-basename with strrchr
PATCH v2 1/1 Replace the usage of non-standard GNU-basename with strrchr
Fixes build against musl libc, since it doesn't provide a GNU-compatible implementation of basename.
---
Notes:
Changes since v1:
- Fixed missing parameter at mesh/rpl.c:150
mesh/mesh-config-json.c | 4 +++- mesh/rpl.c | 4 +++- tools/hex2hcd.c | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-)
mesh/mesh-config-json.c +3 -1
@@ -2708,7 +2708,9 @@ void mesh_config_destroy_nvm(struct mesh_config *cfg)if (!hex2str (cfg->uuid,16 , uuid,sizeof (uuid)))return ; - node_name =basename (node_dir); + node_name =strrchr (node_dir,'/' ); +if (!node_name++) + node_name = node_dir;/* Make sure path name of node follows expected guidelines */ if (strcmp (node_name, uuid))
mesh/rpl.c +3 -1
@@ -147,7 +147,9 @@ static void get_entries(const char *iv_path, struct l_queue *rpl_list)if (!dir)return ; - iv_txt =basename (iv_path); + iv_txt =strrchr (iv_path,'/' ); +if (!iv_txt++) + iv_txt = iv_path;if (sscanf (iv_txt,"%08x" , &iv_index) !=1 ) {closedir (dir);return ;
tools/hex2hcd.c +4 -1
@@ -303,7 +303,10 @@ static void ver_parse_entry(const char *pathname) }if (S_ISREG (st.st_mode)) { -ver_parse_file (basename (pathname)); +const char *bname =strrchr (pathname,'/' ); +if (!bname++) + bname = pathname; +ver_parse_file (bname); goto done; }
Signature · 1 line
2.46.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=890677
---Test result---
Test Summary:
CheckPatch FAIL 0.68 seconds GitLint PASS 0.33 seconds BuildEll PASS 24.71 seconds BluezMake PASS 1744.38 seconds MakeCheck PASS 13.29 seconds MakeDistcheck PASS 179.14 seconds CheckValgrind PASS 254.61 seconds CheckSmatch WARNING 362.17 seconds bluezmakeextell PASS 123.51 seconds IncrementalBuild PASS 1574.25 seconds ScanBuild PASS 1021.39 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v2] Replace the usage of non-standard GNU-basename with strrchr WARNING:LINE_SPACING: Missing a blank line after declarations #100: FILE: tools/hex2hcd.c:307:
+ const char *bname = strrchr(pathname, '/');
+ if (!bname++)
/github/workspace/src/src/13805416.patch total: 0 errors, 1 warnings, 31 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13805416.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:tools/hex2hcd.c:136:26: warning: Variable length array is used.
---
Regards,
Linux Bluetooth