hammer(8): snaprm: fix edge case
authorThomas Nikolajsen <thomas@dragonflybsd.org>
Tue, 27 Sep 2011 05:35:01 +0000 (07:35 +0200)
committerThomas Nikolajsen <thomas@dragonflybsd.org>
Tue, 27 Sep 2011 05:38:49 +0000 (07:38 +0200)
Ensure that @@transid is at end of symlink.

sbin/hammer/cmd_snapshot.c

index 50c7321..ea9cdce 100644 (file)
@@ -296,8 +296,7 @@ hammer_cmd_snaprm(char **av, int ac)
                                mode = path_m;
                        }
                        if (delete && (ptr = strrchr(linkbuf, '@')) &&
-                           ptr > linkbuf && ptr[-1] == '@' &&
-                           ptr + 1 < linkbuf + sizeof(linkbuf) - 1) {
+                           ptr > linkbuf && ptr[-1] == '@' && ptr[1]) {
                                tid = strtoull(ptr + 1, &ptr2, 16);
                                if (*ptr2 == '\0') {
                                        snapshot_del(fsfd, tid);