Skip to content

Commit

Permalink
Merge pull request #1369 from Mellvik/misc
Browse files Browse the repository at this point in the history
[kernel][libc] Fix memcmp
  • Loading branch information
ghaerr committed Jul 14, 2022
2 parents e59601c + 0feb214 commit 06503d8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions elks/arch/i86/drivers/char/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linuxmt/errno.h>
#include <linuxmt/fs.h>
#include <linuxmt/netstat.h>
#include <linuxmt/string.h>

/* character devices and their minor numbers */
extern struct file_operations ne2k_fops; /* 0 CONFIG_ETH_NE2K */
Expand Down
2 changes: 1 addition & 1 deletion elks/lib/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ int memcmp(const void *s1, const void *s2, size_t n)
char res = 0;

for (; n > 0; n--)
if (!(res = *su1++ - *su2++))
if ((res = *su1++ - *su2++))
break;

return res;
Expand Down
2 changes: 1 addition & 1 deletion elkscmd/file_utils/cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int main(int argc, char **argv)
pos++;

errmsg("Files differ at byte position ");
char *p = ltoa(pos);
char *p = ltoa(pos+1);
errstr(p);
errmsg("\n");
return 1;
Expand Down
2 changes: 1 addition & 1 deletion libc/string/memcmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ memcmp(const void *s1, const void *s2, size_t n)
char res = 0;

for (; n > 0; n--)
if (!(res = *su1++ - *su2++))
if ((res = *su1++ - *su2++))
break;

return res;
Expand Down

0 comments on commit 06503d8

Please sign in to comment.