From: Zeng L. <zen...@cn...> - 2014-02-26 10:00:10
|
On Tue, 2014-02-25 at 14:46 +0100, ch...@su... 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 |