Respect the return value of asprintf
authorVolker Lendecke <vl@samba.org>
Sat, 23 Feb 2008 09:26:52 +0000 (10:26 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 23 Feb 2008 09:26:52 +0000 (10:26 +0100)
This removes tons of warnings

warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result

for me. Lots of that kind left though :-)

source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm

index ef3eb3dbcf6fab773305ac6535eb2777685b3a14..a959dc84f60780782fd83581e543f586ad12a40b 100644 (file)
@@ -775,8 +775,7 @@ sub ParseElementPrint($$$$)
                                $self->pidl("for ($counter=0;$counter<$length;$counter++) {");
                                $self->indent;
                                $self->pidl("char *idx_$l->{LEVEL_INDEX}=NULL;");
-                               $self->pidl("asprintf(&idx_$l->{LEVEL_INDEX}, \"[\%d]\", $counter);");
-                               $self->pidl("if (idx_$l->{LEVEL_INDEX}) {");
+                               $self->pidl("if (asprintf(&idx_$l->{LEVEL_INDEX}, \"[\%d]\", $counter) != -1) {");
                                $self->indent;
 
                                $var_name = get_array_element($var_name, $counter);