diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-18 09:12:53 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-18 09:12:53 +0200 |
commit | e66cf821cf1e4bd8c1ef28445c0559269f69bab9 (patch) | |
tree | 3ab9c437fccd1b613570c5af054c6145278677f0 /shell/hush.c | |
parent | a1db8b8415cbac40c679a1ac11f90e97bf5a95f9 (diff) | |
download | busybox-w32-e66cf821cf1e4bd8c1ef28445c0559269f69bab9.tar.gz busybox-w32-e66cf821cf1e4bd8c1ef28445c0559269f69bab9.tar.bz2 busybox-w32-e66cf821cf1e4bd8c1ef28445c0559269f69bab9.zip |
ash,hush: make bare "." set exitcode to 2
function old new delta
dotcmd 300 305 +5
builtin_source 176 171 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/shell/hush.c b/shell/hush.c index e6c083f55..8baccf246 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -7870,21 +7870,26 @@ static int FAST_FUNC builtin_shift(char **argv) | |||
7870 | 7870 | ||
7871 | static int FAST_FUNC builtin_source(char **argv) | 7871 | static int FAST_FUNC builtin_source(char **argv) |
7872 | { | 7872 | { |
7873 | char *arg_path; | 7873 | char *arg_path, *filename; |
7874 | FILE *input; | 7874 | FILE *input; |
7875 | save_arg_t sv; | 7875 | save_arg_t sv; |
7876 | #if ENABLE_HUSH_FUNCTIONS | 7876 | #if ENABLE_HUSH_FUNCTIONS |
7877 | smallint sv_flg; | 7877 | smallint sv_flg; |
7878 | #endif | 7878 | #endif |
7879 | 7879 | ||
7880 | if (*++argv == NULL) | 7880 | arg_path = NULL; |
7881 | return EXIT_FAILURE; | 7881 | filename = *++argv; |
7882 | 7882 | if (!filename) { | |
7883 | if (strchr(*argv, '/') == NULL && (arg_path = find_in_path(*argv)) != NULL) { | 7883 | /* bash says: "bash: .: filename argument required" */ |
7884 | input = fopen_for_read(arg_path); | 7884 | return 2; /* bash compat */ |
7885 | free(arg_path); | 7885 | } |
7886 | } else | 7886 | if (!strchr(filename, '/')) { |
7887 | input = fopen_or_warn(*argv, "r"); | 7887 | arg_path = find_in_path(filename); |
7888 | if (arg_path) | ||
7889 | filename = arg_path; | ||
7890 | } | ||
7891 | input = fopen_or_warn(filename, "r"); | ||
7892 | free(arg_path); | ||
7888 | if (!input) { | 7893 | if (!input) { |
7889 | /* bb_perror_msg("%s", *argv); - done by fopen_or_warn */ | 7894 | /* bb_perror_msg("%s", *argv); - done by fopen_or_warn */ |
7890 | return EXIT_FAILURE; | 7895 | return EXIT_FAILURE; |