From: chrubis@suse.cz
To: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
Cc: ltp-list <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH v2 2/2] lstat/lstat02.c: add ELOOP errno test
Date: Wed, 26 Feb 2014 11:55:32 +0100 [thread overview]
Message-ID: <20140226105531.GA23267@rei> (raw)
In-Reply-To: <1393408265.2066.13.camel@G08JYZSD130126>
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
chrubis@suse.cz
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2014-02-26 10:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-16 6:32 [LTP] [PATCH 1/2] lstat/lstat02.c: cleanup Zeng Linggang
2014-01-16 6:42 ` [LTP] [PATCH 2/2] lstat/lstat02.c: add ELOOP errno test Zeng Linggang
2014-02-18 8:09 ` [LTP] [PATCH v2 1/2] lstat/lstat02.c: cleanup Zeng Linggang
2014-02-18 8:19 ` [LTP] [PATCH v2 2/2] lstat/lstat02.c: add ELOOP errno test Zeng Linggang
2014-02-25 13:46 ` chrubis
[not found] ` <1393408265.2066.13.camel@G08JYZSD130126>
2014-02-26 10:55 ` chrubis [this message]
2014-02-25 13:42 ` [LTP] [PATCH v2 1/2] lstat/lstat02.c: cleanup chrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140226105531.GA23267@rei \
--to=chrubis@suse.cz \
--cc=ltp-list@lists.sourceforge.net \
--cc=zenglg.jy@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox