Module Name: src Committed By: wiz Date: Tue Jan 4 10:35:10 UTC 2011
Modified Files: src/bin/cp: utils.c Log Message: Fix fd leak in error case. Found by cppcheck. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/bin/cp/utils.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/cp/utils.c diff -u src/bin/cp/utils.c:1.37 src/bin/cp/utils.c:1.38 --- src/bin/cp/utils.c:1.37 Tue Dec 21 20:56:01 2010 +++ src/bin/cp/utils.c Tue Jan 4 10:35:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: utils.c,v 1.37 2010/12/21 20:56:01 christos Exp $ */ +/* $NetBSD: utils.c,v 1.38 2011/01/04 10:35:10 wiz Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)utils.c 8.3 (Berkeley) 4/1/94"; #else -__RCSID("$NetBSD: utils.c,v 1.37 2010/12/21 20:56:01 christos Exp $"); +__RCSID("$NetBSD: utils.c,v 1.38 2011/01/04 10:35:10 wiz Exp $"); #endif #endif /* not lint */ @@ -117,6 +117,7 @@ lstat(to.p_path, &sb) : stat(to.p_path, &sb); if (sval == -1) { warn("stat: %s", to.p_path); + (void)close(from_fd); return (1); }