From owner-svn-src-all@FreeBSD.ORG Sat Jun 5 11:06:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93D5A106566B; Sat, 5 Jun 2010 11:06:56 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 839B88FC2B; Sat, 5 Jun 2010 11:06:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o55B6uRQ004775; Sat, 5 Jun 2010 11:06:56 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55B6uKV004773; Sat, 5 Jun 2010 11:06:56 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201006051106.o55B6uKV004773@svn.freebsd.org> From: Edwin Groothuis Date: Sat, 5 Jun 2010 11:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208825 - head/usr.bin/calendar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 11:06:56 -0000 Author: edwin Date: Sat Jun 5 11:06:56 2010 New Revision: 208825 URL: http://svn.freebsd.org/changeset/base/208825 Log: Properly check the return value of chdir, even if it is a "this should not happen" case. Found with: Coverity Prevent(tm) CID: 4932 Modified: head/usr.bin/calendar/io.c Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Sat Jun 5 10:16:23 2010 (r208824) +++ head/usr.bin/calendar/io.c Sat Jun 5 11:06:56 2010 (r208825) @@ -226,7 +226,8 @@ opencal(void) char *home = getenv("HOME"); if (home == NULL || *home == '\0') errx(1, "cannot get home directory"); - chdir(home); + if (chdir(home) != 0) + errx(1, "cannot enter home directory"); for (found = i = 0; i < sizeof(calendarHomes) / sizeof(calendarHomes[0]); i++) if (chdir(calendarHomes[i]) == 0 &&