From e6bd3dbc402a0aa5ff834fde13c4def3172aa70e Mon Sep 17 00:00:00 2001 From: axel Date: Fri, 16 Dec 2005 22:54:37 +1000 Subject: [PATCH] Make the source builtin bail out at once if stat fails. Makes sure no illegal memory acces takes place darcs-hash:20051216125437-ac50b-150f5404037186c5380884416b696d5869704a60.gz --- builtin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin.c b/builtin.c index d2b37a2e2..dd1a51b91 100644 --- a/builtin.c +++ b/builtin.c @@ -2177,9 +2177,9 @@ static int builtin_source( wchar_t ** argv ) if( wstat(argv[1], &buf) == -1 ) { builtin_wperror( L"stat" ); - res = 1; + return 1; } - + if( !S_ISREG(buf.st_mode) ) { sb_append2( sb_err, argv[0], L": Expected a regular file\n", (void *)0 );