Module Name: src Committed By: christos Date: Thu Dec 3 20:58:08 UTC 2015
Modified Files: src/sbin/gpt: add.c Log Message: CID 1341548: Check error returns To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sbin/gpt/add.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/gpt/add.c diff -u src/sbin/gpt/add.c:1.39 src/sbin/gpt/add.c:1.40 --- src/sbin/gpt/add.c:1.39 Wed Dec 2 21:02:43 2015 +++ src/sbin/gpt/add.c Thu Dec 3 15:58:08 2015 @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $"); #endif #ifdef __RCSID -__RCSID("$NetBSD: add.c,v 1.39 2015/12/03 02:02:43 christos Exp $"); +__RCSID("$NetBSD: add.c,v 1.40 2015/12/03 20:58:08 christos Exp $"); #endif #include <sys/types.h> @@ -139,11 +139,13 @@ add(gpt_t gpt, off_t alignment, off_t bl } ent_set(ent, map, type, name); - gpt_write_primary(gpt); + if (gpt_write_primary(gpt) == -1) + return -1; ent = gpt_ent_backup(gpt, i); ent_set(ent, map, type, name); - gpt_write_backup(gpt); + if (gpt_write_backup(gpt) == -1) + return -1; gpt_uuid_snprintf(buf, sizeof(buf), "%d", type); gpt_msg(gpt, "Partition %d added: %s %" PRIu64 " %" PRIu64, i + 1,