On Tue, 2014-02-25 at 14:46 +0100, [email protected] wrote:
Hi
> Hi!
> > Add ELOOP errno test for lstat(2)
> > 
> >  static void setup(void)
> >  {
> > +   int i;
> >     struct passwd *ltpuser;
> >  
> >     tst_require_root(NULL);
> > @@ -131,6 +137,11 @@ static void setup(void)
> >     SAFE_TOUCH(cleanup, "test_file", MODE_RWX, NULL);
> >  
> >     memset(longpathname, 'a', PATH_MAX+1);
> > +
> > +   SAFE_MKDIR(cleanup, "test_eloop", MODE_RWX);
> > +   SAFE_SYMLINK(cleanup, "../test_eloop", "test_eloop/test_eloop");
> > +   for (i = 0; i < 43; i++)
> > +           strcat(elooppathname, "/test_eloop");
> >  }
> 
> Hmm, where has the 43 came from?
> 

I notice that the consecutive symlinks limits in kernel is hardwired to
40 in RHEL 5, 6, 7, but I'm not sure whether this value is the same in
all linux kernels.
And the layer of the directory test_eloop/test_eloop is 2, if we want
the test return ELOOP errno , the layer must more than 41. 43 = 2 + 41.

> Moreover the elloppathname size is PATH_MAX, you cannot be sure that the
> whole string will fit (it likely will, but I would rather have value
> based on the actual string length).
> 

How about:
static char elooppathname[(sizeof("/test_eloop") - 1) * 43 + 2] = ".";

Best regards,
Zeng



------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to