Changeset 732bb0c in mainline
- Timestamp:
- 2009-04-14T19:08:10Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4482bc7
- Parents:
- 47a6708
- Location:
- uspace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/getopt.c
r47a6708 r732bb0c 387 387 for (i = 0; long_options[i].name; i++) { 388 388 /* find matching long option */ 389 if (str ncmp(current_argv, long_options[i].name,390 current_argv_len))389 if (str_lcmp(current_argv, long_options[i].name, 390 str_nlength(current_argv, current_argv_len))) 391 391 continue; 392 392 -
uspace/lib/libc/generic/string.c
r47a6708 r732bb0c 662 662 } 663 663 664 int strncmp(const char *a, const char *b, size_t n)665 {666 size_t c = 0;667 668 while (c < n && a[c] && b[c] && (!(a[c] - b[c])))669 c++;670 671 return ( c < n ? a[c] - b[c] : 0);672 673 }674 675 664 int stricmp(const char *a, const char *b) 676 665 { -
uspace/lib/libc/include/string.h
r47a6708 r732bb0c 87 87 */ 88 88 89 extern int strncmp(const char *, const char *, size_t);90 89 extern int stricmp(const char *, const char *); 91 90 -
uspace/srv/vfs/vfs_ops.c
r47a6708 r732bb0c 805 805 void vfs_rename(ipc_callid_t rid, ipc_call_t *request) 806 806 { 807 size_t len;807 size_t olen, nlen; 808 808 ipc_callid_t callid; 809 809 int rc; 810 810 811 811 /* Retrieve the old path. */ 812 if (!ipc_data_write_receive(&callid, & len)) {812 if (!ipc_data_write_receive(&callid, &olen)) { 813 813 ipc_answer_0(callid, EINVAL); 814 814 ipc_answer_0(rid, EINVAL); 815 815 return; 816 816 } 817 char *old = malloc( len + 1);817 char *old = malloc(olen + 1); 818 818 if (!old) { 819 819 ipc_answer_0(callid, ENOMEM); … … 821 821 return; 822 822 } 823 if ((rc = ipc_data_write_finalize(callid, old, len))) {824 ipc_answer_0(rid, rc); 825 free(old); 826 return; 827 } 828 old[ len] = '\0';823 if ((rc = ipc_data_write_finalize(callid, old, olen))) { 824 ipc_answer_0(rid, rc); 825 free(old); 826 return; 827 } 828 old[olen] = '\0'; 829 829 830 830 /* Retrieve the new path. */ 831 if (!ipc_data_write_receive(&callid, & len)) {831 if (!ipc_data_write_receive(&callid, &nlen)) { 832 832 ipc_answer_0(callid, EINVAL); 833 833 ipc_answer_0(rid, EINVAL); … … 835 835 return; 836 836 } 837 char *new = malloc( len + 1);837 char *new = malloc(nlen + 1); 838 838 if (!new) { 839 839 ipc_answer_0(callid, ENOMEM); … … 842 842 return; 843 843 } 844 if ((rc = ipc_data_write_finalize(callid, new, len))) {844 if ((rc = ipc_data_write_finalize(callid, new, nlen))) { 845 845 ipc_answer_0(rid, rc); 846 846 free(old); … … 848 848 return; 849 849 } 850 new[ len] = '\0';851 852 char *oldc = canonify(old, & len);853 char *newc = canonify(new, NULL);850 new[nlen] = '\0'; 851 852 char *oldc = canonify(old, &olen); 853 char *newc = canonify(new, &nlen); 854 854 if (!oldc || !newc) { 855 855 ipc_answer_0(rid, EINVAL); … … 858 858 return; 859 859 } 860 if (!strncmp(newc, oldc, len)) { 860 oldc[olen] = '\0'; 861 newc[nlen] = '\0'; 862 if (!str_lcmp(newc, oldc, str_length(oldc))) { 861 863 /* oldc is a prefix of newc */ 862 864 ipc_answer_0(rid, EINVAL);
Note:
See TracChangeset
for help on using the changeset viewer.