Rev 4348 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4348 | Rev 4389 | ||
---|---|---|---|
Line 950... | Line 950... | ||
950 | free(new); |
950 | free(new); |
951 | return; |
951 | return; |
952 | } |
952 | } |
953 | oldc[olen] = '\0'; |
953 | oldc[olen] = '\0'; |
954 | newc[nlen] = '\0'; |
954 | newc[nlen] = '\0'; |
955 | if (!str_lcmp(newc, oldc, str_length(oldc))) { |
955 | if ((!str_lcmp(newc, oldc, str_length(oldc))) && |
- | 956 | ((newc[str_length(oldc)] == '/') || |
|
- | 957 | (str_length(oldc) == 1) || |
|
- | 958 | (str_length(oldc) == str_length(newc)))) { |
|
- | 959 | /* |
|
956 | /* oldc is a prefix of newc */ |
960 | * oldc is a prefix of newc and either |
- | 961 | * - newc continues with a / where oldc ends, or |
|
- | 962 | * - oldc was / itself, or |
|
- | 963 | * - oldc and newc are equal. |
|
- | 964 | */ |
|
957 | ipc_answer_0(rid, EINVAL); |
965 | ipc_answer_0(rid, EINVAL); |
958 | free(old); |
966 | free(old); |
959 | free(new); |
967 | free(new); |
960 | return; |
968 | return; |
961 | } |
969 | } |
Line 979... | Line 987... | ||
979 | ipc_answer_0(rid, ENOMEM); |
987 | ipc_answer_0(rid, ENOMEM); |
980 | free(old); |
988 | free(old); |
981 | free(new); |
989 | free(new); |
982 | return; |
990 | return; |
983 | } |
991 | } |
- | 992 | /* Determine the path to the parent of the node with the new name. */ |
|
- | 993 | char *parentc = str_dup(newc); |
|
- | 994 | if (!parentc) { |
|
- | 995 | rwlock_write_unlock(&namespace_rwlock); |
|
- | 996 | ipc_answer_0(rid, rc); |
|
- | 997 | free(old); |
|
- | 998 | free(new); |
|
- | 999 | return; |
|
- | 1000 | } |
|
- | 1001 | char *lastsl = str_rchr(parentc + 1, L'/'); |
|
- | 1002 | if (lastsl) |
|
- | 1003 | *lastsl = '\0'; |
|
- | 1004 | else |
|
- | 1005 | parentc[1] = '\0'; |
|
984 | /* Lookup parent of the new file name. */ |
1006 | /* Lookup parent of the new file name. */ |
985 | rc = vfs_lookup_internal(newc, L_PARENT, &new_par_lr, NULL); |
1007 | rc = vfs_lookup_internal(parentc, L_NONE, &new_par_lr, NULL); |
- | 1008 | free(parentc); /* not needed anymore */ |
|
986 | if (rc != EOK) { |
1009 | if (rc != EOK) { |
987 | rwlock_write_unlock(&namespace_rwlock); |
1010 | rwlock_write_unlock(&namespace_rwlock); |
988 | ipc_answer_0(rid, rc); |
1011 | ipc_answer_0(rid, rc); |
989 | free(old); |
1012 | free(old); |
990 | free(new); |
1013 | free(new); |