ctdb-tools: Use ssize_t instead of int for checking the status of read()
authorAmitay Isaacs <amitay@gmail.com>
Tue, 5 Sep 2017 06:42:58 +0000 (16:42 +1000)
committerAmitay Isaacs <amitay@samba.org>
Sat, 9 Sep 2017 08:53:10 +0000 (10:53 +0200)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/tools/ctdb.c

index f6ba758a1d21f0bd14755e12bd4241af09cedaa7..752902d49c6f704472113a50dc18495217b7fe23 100644 (file)
@@ -4139,6 +4139,7 @@ static int control_restoredb(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
        uint32_t generation;
        uint32_t *pnn_list;
        char timebuf[128];
+       ssize_t n;
        int fd, i;
        int count, ret;
 
@@ -4158,8 +4159,8 @@ static int control_restoredb(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
                db_name = argv[1];
        }
 
-       ret = read(fd, &db_hdr, sizeof(struct db_header));
-       if (ret == -1) {
+       n = read(fd, &db_hdr, sizeof(struct db_header));
+       if (n == -1) {
                ret = errno;
                close(fd);
                fprintf(stderr, "Failed to read db header from file %s\n",
@@ -4377,6 +4378,7 @@ static int control_dumpdbbackup(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
        struct db_header db_hdr;
        char timebuf[128];
        struct dumpdbbackup_state state;
+       ssize_t n;
        int fd, ret, i;
 
        if (argc != 1) {
@@ -4391,8 +4393,8 @@ static int control_dumpdbbackup(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
                return ret;
        }
 
-       ret = read(fd, &db_hdr, sizeof(struct db_header));
-       if (ret == -1) {
+       n = read(fd, &db_hdr, sizeof(struct db_header));
+       if (n == -1) {
                ret = errno;
                close(fd);
                fprintf(stderr, "Failed to read db header from file %s\n",