Re: [PATCH] Non-linux fixes

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

 



On Mon, 2011-01-31 at 13:09 +0100, Samuel Thibault wrote:
> Davidlohr Bueso, le Mon 31 Jan 2011 09:02:24 -0300, a Ãcrit :
> > On Sun, 2011-01-30 at 01:25 +0100, Samuel Thibault wrote:
> > > Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
> > > 
> > > diff --git a/fsck/fsck.c b/fsck/fsck.c
> > > index 87f8210..e8f433e 100644
> > > --- a/fsck/fsck.c
> > > +++ b/fsck/fsck.c
> > > @@ -233,7 +233,7 @@ static dev_t get_disk(const char *device)
> > >  
> > >  static int is_irrotational_disk(dev_t disk)
> > >  {
> > > -	char path[PATH_MAX];
> > > +	char path[33+2*11+1];
> > >  	FILE *f;
> > >  	int rc, x;
> > >  
> > > @@ -1034,7 +1034,7 @@ static int count_slaves(dev_t disk)
> > >  {
> > >  	DIR *dir;
> > >  	struct dirent *dp;
> > > -	char dirname[PATH_MAX];
> > > +	char dirname[24+2*11+1];
> > 
> > That's just plain ugly,
> 
> Well, not so much more ugly than allocating 4096 bytes (or whatever the
> value PATH_MAX is)...
> 
> > does Hurd not have it?
> 
> It does not, since there is no such limitation.

> > why not redefine PATH_MAX?
> > 
> > #ifndef PATH_MAX
> > #define PATH_MAX 24+2*11+1
> > #endif
> 
> Because that would be too small for the first case.

Well, I meant that as a specific example. You might want to put the
PATH_MAX redefine in include/pathnames.h, and make it large enough for
any situation, like glibc does, specially considering that this constant
is used quite a bit throughout util-linux (~38 times).

Thanks,
Davidlohr

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux