(locker_lock): Allow for non-absolute file names.
Showing
1 changed file
with
8 additions
and
2 deletions
... | @@ -425,8 +425,14 @@ locker_lock (locker_t lock) | ... | @@ -425,8 +425,14 @@ locker_lock (locker_t lock) |
425 | 425 | ||
426 | strcpy (tmp, lock->file); | 426 | strcpy (tmp, lock->file); |
427 | p = strrchr (tmp, '/'); | 427 | p = strrchr (tmp, '/'); |
428 | /* A '/' must be present, if not we'll coredump, and that's | 428 | if (!p) |
429 | correct! */ | 429 | { |
430 | free (tmp); | ||
431 | tmp = strdup ("."); | ||
432 | if (!tmp) | ||
433 | return ENOMEM; | ||
434 | } | ||
435 | else | ||
430 | *p = 0; | 436 | *p = 0; |
431 | 437 | ||
432 | if (access (tmp, W_OK)) | 438 | if (access (tmp, W_OK)) | ... | ... |
-
Please register or sign in to post a comment