Hi!
> > > + 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.

I've looked into the kernel sources and it's hardcoded to 40 in
fs/namei.c in follow_link() so I guess that we are fine with this value.

We should probably add a short comment about where the number came from.

> 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] = ".";

I would simplify this to:

#define ELOPFILE "/test_eloop"

static char elooppathname[sizeof(ELOPFILE) * 43] = ".";

That way the buffer would be a few bytes longer than we need.

-- 
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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