aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-12 10:17:41 +0200
committerMattias Andrée <maandree@kth.se>2021-04-12 10:17:41 +0200
commit5eed1e88cf054092256774925fbed3f8db09f75c (patch)
tree9e1af0c59e038449d951be009529da173bcd4939
parentDeduplicate code and make some minor improvements (diff)
downloadcontacts-5eed1e88cf054092256774925fbed3f8db09f75c.tar.gz
contacts-5eed1e88cf054092256774925fbed3f8db09f75c.tar.bz2
contacts-5eed1e88cf054092256774925fbed3f8db09f75c.tar.xz
Minor fix to set-contact-photos
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--TODO1
-rw-r--r--set-contact-photos.c7
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);