diff options
Diffstat (limited to 'src/AFC.c')
| -rw-r--r-- | src/AFC.c | 22 |
1 files changed, 10 insertions, 12 deletions
| @@ -174,6 +174,9 @@ static int afcerror_to_errno(int afcerror) | |||
| 174 | case 10: // occurs if you try to open a file without permission | 174 | case 10: // occurs if you try to open a file without permission |
| 175 | res = EPERM; | 175 | res = EPERM; |
| 176 | break; | 176 | break; |
| 177 | case 19: // occurs if you try to lock an already locked file | ||
| 178 | res = EWOULDBLOCK; | ||
| 179 | break; | ||
| 177 | default: // we'll assume it's an errno value, but report it | 180 | default: // we'll assume it's an errno value, but report it |
| 178 | log_debug_msg("WARNING: unknown AFC error %d, perhaps it's '%s'?\n", afcerror, strerror(afcerror)); | 181 | log_debug_msg("WARNING: unknown AFC error %d, perhaps it's '%s'?\n", afcerror, strerror(afcerror)); |
| 179 | res = afcerror; | 182 | res = afcerror; |
| @@ -986,21 +989,16 @@ iphone_error_t afc_close_file(afc_client_t client, uint64_t handle) | |||
| 986 | 989 | ||
| 987 | /** Locks or unlocks a file on the phone. | 990 | /** Locks or unlocks a file on the phone. |
| 988 | * | 991 | * |
| 989 | * makes use of flock, see | 992 | * makes use of flock on the device, see |
| 990 | * http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/flock.2.html | 993 | * http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/flock.2.html |
| 991 | * | 994 | * |
| 992 | * operation (same as in sys/file.h on linux): | 995 | * @param client The client to lock the file with. |
| 993 | * | ||
| 994 | * LOCK_SH 1 // shared lock | ||
| 995 | * LOCK_EX 2 // exclusive lock | ||
| 996 | * LOCK_NB 4 // don't block when locking | ||
| 997 | * LOCK_UN 8 // unlock | ||
| 998 | * | ||
| 999 | * @param client The client to close the file with. | ||
| 1000 | * @param handle File handle of a previously opened file. | 996 | * @param handle File handle of a previously opened file. |
| 1001 | * @operation the lock or unlock operation to perform. | 997 | * @param operation the lock or unlock operation to perform, this is one of |
| 998 | * AFC_LOCK_SH (shared lock), AFC_LOCK_EX (exclusive lock), | ||
| 999 | * or AFC_LOCK_UN (unlock). | ||
| 1002 | */ | 1000 | */ |
| 1003 | iphone_error_t afc_lock_file(afc_client_t client, uint64_t handle, int operation) | 1001 | iphone_error_t afc_lock_file(afc_client_t client, uint64_t handle, afc_lock_op_t operation) |
| 1004 | { | 1002 | { |
| 1005 | if (!client || (handle == 0)) | 1003 | if (!client || (handle == 0)) |
| 1006 | return IPHONE_E_INVALID_ARG; | 1004 | return IPHONE_E_INVALID_ARG; |
| @@ -1024,7 +1022,7 @@ iphone_error_t afc_lock_file(afc_client_t client, uint64_t handle, int operation | |||
| 1024 | 1022 | ||
| 1025 | if (bytes <= 0) { | 1023 | if (bytes <= 0) { |
| 1026 | afc_unlock(client); | 1024 | afc_unlock(client); |
| 1027 | log_debug_msg("fuck\n"); | 1025 | log_debug_msg("Could not send lock command\n"); |
| 1028 | return IPHONE_E_UNKNOWN_ERROR; | 1026 | return IPHONE_E_UNKNOWN_ERROR; |
| 1029 | } | 1027 | } |
| 1030 | // Receive the response | 1028 | // Receive the response |
