From addd71bd1d8dce7dad2f475bec9a54483cc29b4a Mon Sep 17 00:00:00 2001 From: njoly Date: Fri, 24 Feb 2012 18:00:09 +0000 Subject: [PATCH] Check if fstab file exists before trying to parse it, to avoid warnings from {get,set}fsent() functions if missing. dholland ok. --- lib/libquota/quota_oldfiles.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/libquota/quota_oldfiles.c b/lib/libquota/quota_oldfiles.c index 8970ae8c811a..e2a171295558 100644 --- a/lib/libquota/quota_oldfiles.c +++ b/lib/libquota/quota_oldfiles.c @@ -1,4 +1,4 @@ -/* $NetBSD: quota_oldfiles.c,v 1.8 2012/02/01 06:12:37 dholland Exp $ */ +/* $NetBSD: quota_oldfiles.c,v 1.9 2012/02/24 18:00:09 njoly Exp $ */ /* * Copyright (c) 1980, 1990, 1993 @@ -33,7 +33,7 @@ */ #include -__RCSID("$NetBSD: quota_oldfiles.c,v 1.8 2012/02/01 06:12:37 dholland Exp $"); +__RCSID("$NetBSD: quota_oldfiles.c,v 1.9 2012/02/24 18:00:09 njoly Exp $"); #include #include @@ -204,6 +204,13 @@ __quota_oldfiles_load_fstab(void) return; } + /* + * Check if fstab file exists before trying to parse it. + * Avoid warnings from {get,set}fsent() if missing. + */ + if (access(_PATH_FSTAB, F_OK) == -1 && errno == ENOENT) + return; + /* * XXX: should be able to handle ext2fs quota1 files too *