Commit Diff


commit - 05fa71181ce0b8e193160790042225acf3a73b14
commit + e6b88e161ad828106984b234e87b11f46df49a53
blob - ceacd908686d8842b986df5c5ab20fbcf3acc81a
blob + 665a8692e199221d7bc06d855a7b147f5856fa8c
--- lib/reference.c
+++ lib/reference.c
@@ -1320,7 +1320,7 @@ done:
 	free(path_refs);
 	free(path);
 	if (tmppath) {
-		if (unlink(tmppath) != 0 && err == NULL)
+		if (unlink(tmppath) == -1 && err == NULL)
 			err = got_error_from_errno2("unlink", tmppath);
 		free(tmppath);
 	}
@@ -1501,7 +1501,7 @@ delete_loose_ref(struct got_reference *ref, struct got
 
 	/* XXX: check if old content matches our expectations? */
 
-	if (unlink(path) != 0)
+	if (unlink(path) == -1)
 		err = got_error_from_errno2("unlink", path);
 done:
 	if (ref->lf == NULL && lf)
blob - acd2e30627d8bd30e774b7821cde664cd2092c4d
blob + 26c789d75c4c6e26b8f5d2f0584e1cfaed88bbb6
--- lib/worktree.c
+++ lib/worktree.c
@@ -4133,12 +4133,12 @@ schedule_for_deletion(void *arg, unsigned char status,
 		size_t root_len;
 
 		if (dirfd != -1) {
-			if (unlinkat(dirfd, de_name, 0) != 0) {
+			if (unlinkat(dirfd, de_name, 0) == -1) {
 				err = got_error_from_errno2("unlinkat",
 				    ondisk_path);
 				goto done;
 			}
-		} else if (unlink(ondisk_path) != 0) {
+		} else if (unlink(ondisk_path) == -1) {
 			err = got_error_from_errno2("unlink", ondisk_path);
 			goto done;
 		}