cURL / Mailing Lists / curl-library / Single Mail

curl-library

longjump warning

From: Andy Cedilnik <andy.cedilnik_at_kitware.com>
Date: Fri, 08 Oct 2004 11:40:42 -0400

Hi,

There is a warning in hostip.c at least in 7.12.1:

Building object file hostip.o...
/home/kitware/Dashboards/My Tests/CMake/Source/CTest/Curl/hostip.c: In
function `Curl_resolv':
/home/kitware/Dashboards/My Tests/CMake/Source/CTest/Curl/hostip.c:382:
warning: variable `rc' might be clobbered by `longjmp' or `vfork'

The problem is in the code:

  /* default to failure */
  int rc = CURLRESOLV_ERROR;
  *entry = NULL;

#ifdef HAVE_SIGSETJMP
  /* this allows us to time-out from the name resolver, as the timeout
     will generate a signal and we will siglongjmp() from that here */
  if(!data->set.no_signal && sigsetjmp(curl_jmpenv, 1)) {
    /* this is coming from a siglongjmp() */
    failf(data, "name lookup timed out");
    return CURLRESOLV_ERROR;
  }
#endif

but can be easily fixed by changing the code to:

  /* default to failure */
  int rc;
  *entry = NULL;

#ifdef HAVE_SIGSETJMP
  /* this allows us to time-out from the name resolver, as the timeout
     will generate a signal and we will siglongjmp() from that here */
  if(!data->set.no_signal && sigsetjmp(curl_jmpenv, 1)) {
    /* this is coming from a siglongjmp() */
    failf(data, "name lookup timed out");
    return CURLRESOLV_ERROR;
  }
#endif
  rc = CURLRESOLV_ERROR;

                                Andy
Received on 2004-10-08