[pacman-dev] Dealing with asprintf failures

Nezmer git at nezmer.info
Sun Jun 27 14:49:08 EDT 2010


> This prints an error, but does not actually bail, on failure of
> asprintf.  This is an improvement over the current code as we would
> know where the error occurred, but feels wrong not to exit.  Note
> that several of the functions affected return void, so erroring out
> is not a simple "return -1".
> 

I don't know any C so sorry If that sounds stupid.

Wouldn't creating an errfunc works here?

#sudo code:

int errfunc(void) {
  return -1 ;
}

void somefunc(void) {
  errfunc() ;
}

int main(void) {
  somefunc() ;
}

> So, any ideas on the best way to approach this?
> 
> Allan
> 


More information about the pacman-dev mailing list