Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 May 2004 14:33:03 +0100
From:      "Stuart Walsh" <stu@ipng.org.uk>
To:        "Anton Alin-Adrian" <aanton@reversedhell.net>, <freebsd-hackers@freebsd.org>
Subject:   Re: fopen("file","a")
Message-ID:  <007c01c44326$18beeb40$390310ac@swalsh>
References:  <40AF7F5A.1080500@reversedhell.net>

next in thread | previous in thread | raw e-mail | index | archive | help

----- Original Message ----- 
From: "Anton Alin-Adrian" <aanton@reversedhell.net>
To: <freebsd-hackers@freebsd.org>
Sent: Saturday, May 22, 2004 5:27 PM
Subject: fopen("file","a")


> Hey folks.
>
> Running FreeBSD 4.9-RELEASE
>
> I am just wondering:
>
> man fopen
> ---man---
>       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.
> ---man---
>
>
> However, the following snippet:
>
> --snip--
> FILE *fp_queue;
>
> if ( (fp_queue=fopen(fqueue,"a"))  ==NULL);//will wait for locks
> {
> perror("fopen(fqueue,\"a\")");
> //exit(EXIT_FAILURE);
> }
> --snip--
>
>

You have a semicolon after your if... looks like a typo, but that will mean
the perror always gets called.

Regards,

Stuart



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?007c01c44326$18beeb40$390310ac>