This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/10511] New: popen() returns fp on non existing file
- From: "wharms at bfs dot de" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 12 Aug 2009 07:35:07 -0000
- Subject: [Bug libc/10511] New: popen() returns fp on non existing file
- Reply-to: sourceware-bugzilla at sourceware dot org
popen() returns a filepointer even when the file in question does not exists.
that makes complicated for subsequenting code to check for success.
I am aware that the posix specs say nothing about using a non existing file and
an error msg from the shell is shown. ntl all programmers i ask where not aware
that popen may fail this way and simply assume that a filepointer means that
everything works.
/lib/libc.so.6
GNU C Library stable release version 2.9 (20081117), by Roland McGrath et al.
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Configured for i686-suse-linux.
Compiled by GNU CC version 4.3.2 [gcc-4_3-branch revision 141291].
Compiled on a Linux 2.6.27 system on 2009-02-22.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
NoVersion patch for broken glibc 2.0 binaries
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
#include <stdio.h>
int main()
{
FILE *fp=popen("blub","w");
if (!fp)
printf("popen failed\n");
else
printf("popen worked\n");
return 0;
}
result;
sh: blub: command not found
popen worked
--
Summary: popen() returns fp on non existing file
Product: glibc
Version: 2.9
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: wharms at bfs dot de
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=10511
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.