Sujet : Re: Fine, let's see you using pathconf(3) on Windows (was: Re: Then there's PATH_MAX)
De : fsquared (at) *nospam* fsquared.linux (Farley Flud)
Groupes : comp.os.linux.advocacyDate : 10. Dec 2024, 15:44:12
Autres entêtes
Organisation : UsenetExpress - www.usenetexpress.com
Message-ID : <180fd7fa66284739$61502$1728$802601b3@news.usenetexpress.com>
References : 1 2 3
User-Agent : Pan/0.146 (Hic habitat felicitas; d7a48b4 gitlab.gnome.org/GNOME/pan.git)
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!