[BusyBox] Silence... Ok. New patch
Vladimir N. Oleynik
dzo at simtreas.ru
Sun Mar 25 17:09:44 UTC 2001
"Vladimir N. Oleynik" wrote:
> I work with linear shell parser for sh/cmdedit/ftp and strcoll() for Uclibc and
> very busy.
> I see silence. Hmm.
> Small patch to libbb/print_file_by_name.c:
>
> - remove bug: not closing files (for example `cat' can open very many files)
Oops. Not have bug. Exuse me. I tired... Patch to patch. ;)
> - add standart features: for directory requires put warning "file: Is
> directory".
> diff -ru busybox.orig/print_file.c busybox/print_file.c
> --- busybox.orig/print_file.c Sun Mar 25 20:28:10 2001
> +++ busybox/print_file.c Sun Mar 25 20:25:26 2001
> @@ -26,6 +26,7 @@
> */
>
> #include <stdio.h>
> +#include <sys/stat.h>
> #include "libbb.h"
>
>
> @@ -42,10 +43,20 @@
> extern int print_file_by_name(char *filename)
> {
> FILE *file;
> + struct stat statBuf;
> + int status = TRUE;
> +
> if ((file = wfopen(filename, "r")) == NULL)
> return FALSE;
> - print_file(file);
> - return TRUE;
> +
> + if(is_directory(filename, TRUE, &statBuf)==TRUE) {
> + error_msg("%s: Is directory", filename);
> + status = FALSE;
> + } else {
> + print_file(file);
> + }
> + fclose(file);
- flose(file);
> + return status;
> }
--w
vodz
More information about the busybox
mailing list