Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdev name comparison is wrong? #4

Open
jshen28 opened this issue Aug 12, 2022 · 0 comments
Open

cdev name comparison is wrong? #4

jshen28 opened this issue Aug 12, 2022 · 0 comments

Comments

@jshen28
Copy link

jshen28 commented Aug 12, 2022

Hello,

I have a question about the following code,

if (strncmp((char *)a, ((struct sysfs_class_device *)b)->name,
strlen((char *)a)) == 0)
return 1;

In the code, it will compare input with target using the length of input, but if input is something like host1 and there is already a node with name host12, it will mistakenly returns host12.

So my question is why not using strcmp? Thank you.

Best,
Jiatong Shen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant