Commit d1688ce08917f7071c7bbfc44ae27624c0a1efd8

Stefan Sperling 2019-02-06T00:08:47

remove a pointless error code

diff --git a/include/got_error.h b/include/got_error.h
index 3c5386e..ca9b003 100644
--- a/include/got_error.h
+++ b/include/got_error.h
@@ -28,7 +28,7 @@
 #define GOT_ERR_BAD_OBJ_HDR	10
 #define GOT_ERR_OBJ_TYPE	11
 #define GOT_ERR_BAD_OBJ_DATA	12
-#define GOT_ERR_FILE_OPEN	13
+/* 13 is currently free for re-use */
 #define GOT_ERR_BAD_PACKIDX	14
 #define GOT_ERR_PACKIDX_CSUM	15
 #define GOT_ERR_BAD_PACKFILE	16
@@ -92,7 +92,7 @@ static const struct got_error {
 	{ GOT_ERR_BAD_OBJ_HDR,	"bad object header" },
 	{ GOT_ERR_OBJ_TYPE,	"wrong type of object" },
 	{ GOT_ERR_BAD_OBJ_DATA,	"bad object data" },
-	{ GOT_ERR_FILE_OPEN,	"could not open file" },
+	{ 13,			"unused error code" },
 	{ GOT_ERR_BAD_PACKIDX,	"bad pack index file" },
 	{ GOT_ERR_PACKIDX_CSUM, "pack index file checksum error" },
 	{ GOT_ERR_BAD_PACKFILE,	"bad pack file" },
diff --git a/lib/diff.c b/lib/diff.c
index a3da580..cefba42 100644
--- a/lib/diff.c
+++ b/lib/diff.c
@@ -54,7 +54,7 @@ diff_blobs(struct got_blob_object *blob1, struct got_blob_object *blob2,
 	if (blob1) {
 		f1 = got_opentemp();
 		if (f1 == NULL)
-			return got_error(GOT_ERR_FILE_OPEN);
+			return got_error_from_errno();
 	} else
 		flags |= D_EMPTY1;
 
@@ -62,7 +62,7 @@ diff_blobs(struct got_blob_object *blob1, struct got_blob_object *blob2,
 		f2 = got_opentemp();
 		if (f2 == NULL) {
 			fclose(f1);
-			return got_error(GOT_ERR_FILE_OPEN);
+			return got_error_from_errno();
 		}
 	} else
 		flags |= D_EMPTY2;