GO 46 !


RD Dreams

MacDizzy

DBS

YADBS

SourceForge

SIX

Rally.co.in

Rossi Files

Open Solaris

Meebo

Crash.net

MotoGP

Beginning of End

Elving's blog

Sandeep's page

Sun Forums

Air Cooled RD

MindStorms

LEGO-Robotics

Track Guide

Track Forum

M's blogs

BikesZone

Kawasaki Triples

PhRack

Metallica

Distance Running

RD Shop

SMX - Solaris Minix

Elephant Story

WD40

Dan's M/C Site

Tunnel Rats

Gatorade

Orkut

Free Science

Spiderman McBride

Racing a Fiat

Forsyth

BSM Archives

Bugatti Veyron

RNR Racing

popen / pclose - Solaris

On Solaris 6, 8, 9:

#include <stdio.h>

main()
{
        FILE *fp = popen("/bin/ls", "r");
        while (fgetc(fp) != -1)
                ;
        pclose(fp);
        perror("");
}

bash-2.03$ cc test.c
bash-2.03$ ./a.out
Illegal seek
bash-2.03$ 

Whathafakisthat??

Comments [4]




Trackback URL: http://blogs.sun.com/motor/entry/popen_pclose_solaris
Comments:

ok, looks like pclose() does a llseek() internally...

Posted by motor on mars 30, 2007 at 02:25 PD PDT #

Actually, you should only call perror if the pclose actually failed:

http://www.opengroup.org/onlinepubs/009695399/functions/errno.html

"The setting of errno after a successful call to a function is unspecified unless the description of that function specifies that errno shall not be modified."

Posted by Dan Nelson on mars 30, 2007 at 09:55 PD PDT #

Yes, that makes sense...thanks.

Posted by motor on prill 12, 2007 at 09:10 MD PDT #

very interesting

Posted by auction car insurance salvage on qershor 11, 2007 at 12:39 MD PDT #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed