Deutsch   English   Français   Italiano  
<180fd7fa66284739$61502$1728$802601b3@news.usenetexpress.com>

View for Bookmarking (what is this?)
Look up another Usenet article

From: Farley Flud <fsquared@fsquared.linux>
Subject: Re: Fine, let's see you using pathconf(3) on Windows (was: Re: Then there's PATH_MAX)
Newsgroups: comp.os.linux.advocacy
References: <lrnft4Fd071U5@mid.individual.net> <180fd2f32d5884e5$6049$1734$802601b3@news.usenetexpress.com> <lrqvnoF55oU2@mid.individual.net>
User-Agent: Pan/0.146 (Hic habitat felicitas; d7a48b4 gitlab.gnome.org/GNOME/pan.git)
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 59
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!panix!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news.usenetexpress.com!not-for-mail
Date: Tue, 10 Dec 2024 14:44:12 +0000
Nntp-Posting-Date: Tue, 10 Dec 2024 14:44:12 +0000
X-Received-Bytes: 1403
Organization: UsenetExpress - www.usenetexpress.com
X-Complaints-To: abuse@usenetexpress.com
Message-Id: <180fd7fa66284739$61502$1728$802601b3@news.usenetexpress.com>

On Tue, 10 Dec 2024 13:58:17 +0000, vallor wrote:

> 
>  - - cut here %<- - -
>

Should be "flush here."


> 
> if(argv[1])
>     {
>     path = argv[1];
>     }
>     }
> 

WTF!

You check for arguments like this:

if(argc != 2)

or:

if(argv[1] == NULL)


>
>     else {
>     path = "/";
>

WTF!

You are assigning a pointer with the value 0x2F.

If it's then passed to pathconf() then KABOOM!


>
> printf("%d\n",result);
> 

"result" is an int.  pathcomp() returns a long int.

You should either have declared "result" as a long int
or:

result = (int)pathconf(path,_PC_PATH_MAX)



Congrats.  In a few short lines you have created a huge mess.



-- 
Hail Linux!  Hail FOSS!  Hail Stallman!