* Subrata Modak <[EMAIL PROTECTED]> [2008-04-14 16:56:15]:

> On Sun, 2008-04-13 at 22:45 +0300, S.Ça??lar Onur wrote:
> > Hi;
> > 
> > Following patch checks return values of asprintf calls else gcc-4.3.0 fails 
> > like following;
> > 
> > ...
> > libstats.c:308: error: ignoring return value of 'asprintf', declared with 
> > attribute warn_unused_result
> > libstats.c:312: error: ignoring return value of 'asprintf', declared with 
> > attribute warn_unused_result
> 
> Lets get this reviewed by the RT community.
> Sebastien/Dino/Darren/Robert/anybody, any comments for this patch.
> Involves RT tests here !!
> 
> Regards--
> Subrata
> 
> > ...
> > 
> > Signed-off-by: S.Ça??lar Onur <[EMAIL PROTECTED]>
Acked-by: Chirag <[EMAIL PROTECTED]>

> > 
> > diff -Nur 
> > ltp-full-20080331.orig/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load_single.c
> >  
> > ltp-full-20080331/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load_single.c
> > --- 
> > ltp-full-20080331.orig/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load_single.c
> >      2008-03-31 10:25:08.000000000 +0300
> > +++ 
> > ltp-full-20080331/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load_single.c
> >   2008-04-13 22:40:26.000000000 +0300
> > @@ -103,9 +103,15 @@
> >     stats_container_init(&dat, iterations);
> >     stats_container_init(&hist, HIST_BUCKETS);
> >     stats_quantiles_init(&quantiles, (int)log10(iterations));
> > -   asprintf(&samples_filename, "%s-samples", filename_prefix);
> > -   asprintf(&hist_filename, "%s-hist", filename_prefix);
> > +   if (asprintf(&samples_filename, "%s-samples", filename_prefix) == -1) {
> > +           fprintf(stderr, "Failed to allocate string for samples 
> > filename\n");
> > +           return -1;
> > +   }
> >  
> > +   if (asprintf(&hist_filename, "%s-hist", filename_prefix) == -1) {
> > +           fprintf(stderr, "Failed to allocate string for samples 
> > filename\n");
> > +           return -1;
> > +   }
> >     next = rt_gettime();
> >     while (i < iterations) {
> >             next += period;
> > diff -Nur ltp-full-20080331.orig/testcases/realtime/lib/libstats.c 
> > ltp-full-20080331/testcases/realtime/lib/libstats.c
> > --- ltp-full-20080331.orig/testcases/realtime/lib/libstats.c        
> > 2008-03-31 10:25:08.000000000 +0300
> > +++ ltp-full-20080331/testcases/realtime/lib/libstats.c     2008-04-13 
> > 22:37:04.000000000 +0300
> > @@ -305,11 +305,11 @@
> >         return 0;
> >  
> >      /* generate the filenames */
> > -    if (!asprintf(&datfile, "%s.dat", filename) < 0) {
> > +    if (asprintf(&datfile, "%s.dat", filename) == -1) {
> >             fprintf(stderr, "Failed to allocate string for data 
> > filename\n");
> >             return -1;
> >     }
> > -    if (!asprintf(&pltfile, "%s.plt", filename) < 0) {
> > +    if (asprintf(&pltfile, "%s.plt", filename) == -1) {
> >             fprintf(stderr, "Failed to allocate string for plot 
> > filename\n");
> >             return -1;
> >     }
> > 
> > Cheers
> 

-- 
Cheers,
Chirag Jog


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to