ubase

suckless linux base utils
git clone git://git.2f30.org/ubase.git
Log | Files | Refs | README | LICENSE

commit 3bb0f0fbdde37789ee51e718225cbd278e9167f9
parent 005e90a7ff7a81a0383ff5b0c0e501b98391b06c
Author: sin <sin@2f30.org>
Date:   Sat Feb 15 18:26:01 +0000

Check setmntent() for failures

Diffstat:
swapoff.c | 2++
swapon.c | 2++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git 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 @@ -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)) {