From 5eed1e88cf054092256774925fbed3f8db09f75c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 12 Apr 2021 10:17:41 +0200 Subject: Minor fix to set-contact-photos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- TODO | 1 - set-contact-photos.c | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index eeeb141..fa80297 100644 --- a/TODO +++ b/TODO @@ -11,7 +11,6 @@ Test list-chat-contacts Test list-contact-organisations Test list-organisation-contacts Test set-contact-blocks -Test set-contact-photos Test unblock-contact Add ability to filter on unset values in entries Add ability to remove values in entries diff --git a/set-contact-photos.c b/set-contact-photos.c index 51366dd..744e8a2 100644 --- a/set-contact-photos.c +++ b/set-contact-photos.c @@ -60,9 +60,9 @@ again: } else if (r[0] == '/' && r[1] == '.' && r[2] == '.' && (r[3] == '/' || !r[3])) { *w = '\0'; target = get_target(ret, &targetlen); + *w = '/'; if (!target) { - while (w[-1] != '/') - w--; + while (*--w != '/'); r += 3; } else if (!target[0]) { eprintf("%s: encountered symlink with empty target\n", path); @@ -86,8 +86,7 @@ again: errno = ELOOP; eprintf("%s:", path); } - while (w[-1] != '/') - w--; + while (*--w != '/'); len1 = (size_t)(w - ret); len2 = targetlen; len3 = retlennul - (size_t)(r - ret); -- cgit v1.2.3-70-g09d2