[LTP] [PATCH v4 2/2] link/link05: Convert to new API

Li Wang liwang@redhat.com
Thu Nov 4 08:12:22 CET 2021


Patch pushed with the following improvements. Thanks~

--- a/testcases/kernel/syscalls/link/link05.c
+++ b/testcases/kernel/syscalls/link/link05.c
@@ -22,19 +22,19 @@ static int nlinks = 1000;

 static void verify_link(void)
 {
-       struct stat fbuf, lbuf;
        int cnt;
-       char lname[255];
+       char lname[1024];
+       struct stat fbuf, lbuf;

        for (cnt = 1; cnt < nlinks; cnt++) {
-               sprintf(lname, "%s%d", fname, cnt);
-               TST_EXP_PASS(link(fname, lname), "link(%s, %s)", fname,
lname);
+               sprintf(lname, "%s_%d", fname, cnt);
+               TST_EXP_PASS_SILENT(link(fname, lname), "link(%s, %s)",
fname, lname);
        }

        SAFE_STAT(fname, &fbuf);

        for (cnt = 1; cnt < nlinks; cnt++) {
-               sprintf(lname, "%s%d", fname, cnt);
+               sprintf(lname, "%s_%d", fname, cnt);

                SAFE_STAT(lname, &lbuf);
                if (fbuf.st_nlink <= 1 || lbuf.st_nlink <= 1 ||
@@ -49,6 +49,7 @@ static void verify_link(void)
                        break;
                }
        }
+
        if (cnt >= nlinks) {
                tst_res(TPASS,
                         "link(%s, %s[1-%d]) ret %ld for %d files, "
@@ -58,7 +59,7 @@ static void verify_link(void)
        }

        for (cnt = 1; cnt < nlinks; cnt++) {
-               sprintf(lname, "%s%d", fname, cnt);
+               sprintf(lname, "%s_%d", fname, cnt);
                SAFE_UNLINK(lname);
        }
 }

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20211104/cc022771/attachment.htm>


More information about the ltp mailing list