Skip to Content.
Sympa Menu

freetds - Re: [freetds] [PATCH] VMS build update

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: christos AT zoulas.com (Christos Zoulas)
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] [PATCH] VMS build update
  • Date: Sat, 6 Nov 2004 18:09:50 -0500

On Nov 6, 5:09pm, jklowden AT schemamania.org ("James K. Lowden") wrote:
-- Subject: Re: [freetds] [PATCH] VMS build update

| Hi Craig,
|
| - if (freopen(options.input_filename, "r", stdin) < 0) {
| + if ((int)freopen(options.input_filename, "r", stdin) < 0) {
|
| Could I change all these to:
|
| if (freopen(options.input_filename, "r", stdin) < (FILE*)0) {
|
| I think that's more honest. BTW, does "< NULL" work better?
|
| Similarly,
|
| - if (options.verbose < 0) {
| + if ((int)options.verbose < 0) {
|
| oughta be
|
| if (options.verbose < (FILE*)0) {
|
| I'd prefer these unless you can convince me otherwise or your compiler
| isn't satisfied.
|
| Thanks for the patch.
|

Guys, the code should read:

if (freopen(options.input_filename, "r", stdin) == NULL) {
...
}

if (options.verbose == NULL) {
...
}

You shound *not* check for less than NULL, it is simply wrong! From the
Friendly manual page:

RETURN VALUES
Upon successful completion fopen(), fdopen() and freopen() return a FILE
pointer. Otherwise, NULL is returned and the global variable errno is
set to indicate the error.

christos




Archive powered by MHonArc 2.6.24.

Top of Page