Whamcloud - gitweb
adding error handling in runas.c in case the malloc() fails
authorpengzhao <pengzhao>
Tue, 18 Mar 2003 05:22:39 +0000 (05:22 +0000)
committerpengzhao <pengzhao>
Tue, 18 Mar 2003 05:22:39 +0000 (05:22 +0000)
lustre/tests/runas.c

index 348ddb9..8731699 100644 (file)
@@ -80,6 +80,11 @@ main(int argc, char**argv)
 
         // assemble the command
         my_argv = (char**)malloc(sizeof(char*)*(argc+1-optind));
+               if(my_argv == NULL) {
+                       fprintf(stderr, "Error in allocating memory. (%s)\n", strerror(errno));
+                               exit(-1);
+               }
+               
         for(i=optind; i< argc; i++) {
                 my_argv[i-optind] = argv[i];
 //                printf("%s\n",my_argv[i-optind]);