diff --git a/swapoff.c b/swapoff.c index 806d1f0..2d2b7ac 100644 --- a/swapoff.c +++ b/swapoff.c @@ -36,6 +36,8 @@ main(int argc, char *argv[]) FILE *fp; fp = setmntent("/etc/fstab", "r"); + if (!fp) + eprintf("setmntent %s:", "/etc/fstab"); while ((me = getmntent(fp)) != NULL) { if (strcmp(me->mnt_type, MNTTYPE_SWAP) == 0) { if (swapoff(me->mnt_fsname) < 0) { diff --git a/swapon.c b/swapon.c index 40e6c9f..6b3d32f 100644 --- a/swapon.c +++ b/swapon.c @@ -43,6 +43,8 @@ main(int argc, char *argv[]) FILE *fp; fp = setmntent("/etc/fstab", "r"); + if (!fp) + eprintf("setmntent %s:", "/etc/fstab"); while ((me = getmntent(fp)) != NULL) { if (strcmp(me->mnt_type, MNTTYPE_SWAP) == 0 && (hasmntopt(me, MNTOPT_NOAUTO) == NULL)) {