LTP test case write04 will crash on uClinux platform.

Bellow is the fix:
--
Index: testcases/kernel/syscalls/write/write04.c
===================================================================
--- testcases/kernel/syscalls/write/write04.c
+++ testcases/kernel/syscalls/write/write04.c
@@ -71,6 +71,10 @@
 static sigjmp_buf jmp;
 int rfd, wfd;

+#ifdef UCLINUX
+char *wbuf;
+#endif
+
 int main(int argc, char **argv)
 {
        int lc;
@@ -79,7 +83,9 @@
        struct stat buf;
        int fail;
        int cnt;
+#ifndef UCLINUX
        char wbuf[17 * PIPE_SIZE_TEST];
+#endif
        struct sigaction sigptr;        /* set up signal handler */

        /* parse standard options */
@@ -221,6 +227,17 @@
  */
 void setup(void)
 {
+#ifdef UCLINUX
+       /* Allocate wbuf in heap not in the local function stack */
+       int pagesize = getpagesize();
+
+       wbuf = (char *) malloc(17 * pagesize);
+       if (!wbuf) {
+               tst_resm(TBROK, "malloc failed");
+               cleanup();
+       }
+#endif
+
        /* capture signals */
        tst_sig(FORK, DEF_HANDLER, cleanup);

@@ -244,6 +261,12 @@

 void cleanup()
 {
+
+#ifdef UCLINUX
+       if (wbuf)
+               free(wbuf);
+#endif
+
        /*
         * print errno log if that option was specified.
         */
--


Best regards,
Vivi Li
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to