[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#376756: libc6: popen() should return NULL



Package: libc6
Version: 2.3.6-15
Severity: normal

Hello,

According to section 15.2 of glibc-doc ("Pipe to a Subprocess") the
function popen() should return NULL if it failed to open the pipe.
However, the function is returning a non NULL pointer, as can be seen
by running the program below:

--------------------------------------
/* testpopen.c */
#include <stdio.h>

int main(){
  FILE *F = NULL;
  printf("Before: F = %p\n", F);
  F = popen("nothing", "w");
  printf("After:  F = %p\n", F);
  pclose(F);
  return 0;
}
--------------------------------------

$ gcc testpopen.c
$ ./a.out
Before: F = (nil)
After:  F = 0x501010
sh: nothing: command not found

Thanks,


-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-amd64-k8
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8)

Versions of packages libc6 depends on:
ii  tzdata                        2006g-2    Time Zone and Daylight Saving Time

libc6 recommends no packages.

-- no debconf information



Reply to: