[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gawk-stable] bug: fatal error when getline from directory
From: |
Aharon Robbins |
Subject: |
Re: [gawk-stable] bug: fatal error when getline from directory |
Date: |
Sun, 04 Jan 2009 06:16:14 +0200 |
> Date: Sat, 3 Jan 2009 23:34:04 +0100
> To: Aharon Robbins <address@hidden>
> Cc: address@hidden, address@hidden, address@hidden,
> address@hidden
> Subject: Re: [gawk-stable] bug: fatal error when getline from directory
> From: Paolo <address@hidden>
>
> well, all such *awk incarnation do the wrong thing IMHO:
I didn't claim that what gawk did was right.
> #-------------
> --- io.c 2009-01-03 23:28:14.000000000 +0100
> +++ io.c 2009-01-03 23:25:21.000000000 +0100
> @@ -1591,8 +1591,11 @@
> if (openfd == INVALID_HANDLE)
> openfd = open(name, flag, 0666);
> if (openfd != INVALID_HANDLE) {
> - if (os_isdir(openfd))
> - fatal(_("file `%s' is a directory"), name);
> + if (os_isdir(openfd)) {
> + openfd = INVALID_HANDLE;
> + errno = EISDIR;
> + // fatal(_("file `%s' is a directory"), name);
> + }
> }
> /*
> * At this point, fd could still be INVALID_HANDLE.
> #-------------
>
> test:
> $ ./gawk 'BEGIN{x=4; r=getline x < "/tmp"; print r " " x " ERRNO=" ERRNO}'
> -1 4 ERRNO=Is a directory
This may be what I end up doing. I just want to think about it some
more. I've learned that the quick fix isn't always the right fix.
> seems to work - but I really like more John Cowan's idea, awkish and
> perlish :)
It's a thought I've toyed with over the years, but again, I'm not sure
the additional code complexity gives enough Return On Investment.
Thanks,
Arnold
- Re: [gawk-stable] bug: fatal error when getline from directory, (continued)
- Re: [gawk-stable] bug: fatal error when getline from directory, John Cowan, 2009/01/04
- Re: [gawk-stable] bug: fatal error when getline from directory, Eli Zaretskii, 2009/01/04
- Re: [gawk-stable] bug: fatal error when getline from directory, Paolo, 2009/01/05
- Re: [gawk-stable] bug: fatal error when getline from directory, Eli Zaretskii, 2009/01/05
- Re: [gawk-stable] bug: fatal error when getline from directory, Paolo, 2009/01/05
- Re: [gawk-stable] bug: fatal error when getline from directory, Andrew J. Schorr, 2009/01/05
Re: [gawk-stable] bug: fatal error when getline from directory, Aharon Robbins, 2009/01/03
Re: [gawk-stable] bug: fatal error when getline from directory,
Aharon Robbins <=
Re: [gawk-stable] bug: fatal error when getline from directory, Aharon Robbins, 2009/01/05
Re: [gawk-stable] bug: fatal error when getline from directory, Aharon Robbins, 2009/01/05
Re: [gawk-stable] bug: fatal error when getline from directory, Aharon Robbins, 2009/01/06