コード例 #1
0
ファイル: fault.c プロジェクト: DeezNuts12/freestyledash
 void dump_core(void)
{
	/* Note that even if core dumping has been disabled, we still set up
	 * the core path. This is to handle the case where core dumping is
	 * turned on in smb.conf and the relevant daemon is not restarted.
	 */
	if (!lp_enable_core_files()) {
		DEBUG(0, ("Exiting on internal error (core file administratively disabled\n"));
		exit(1);
	}

	if (*corepath != '\0') {
		/* The chdir might fail if we dump core before we finish
		 * processing the config file.
		 */
		if (chdir(corepath) != 0) {
			DEBUG(0, ("unable to change to %s", corepath));
			DEBUGADD(0, ("refusing to dump core\n"));
			exit(1);
		}

		DEBUG(0,("dumping core in %s\n", corepath));
	}

	umask(~(0700));
	dbgflush();

	/* Ensure we don't have a signal handler for abort. */
#ifdef SIGABRT
	CatchSignal(SIGABRT,SIGNAL_CAST SIG_DFL);
#endif

	abort();
}
コード例 #2
0
ファイル: dhttp.c プロジェクト: Unidata/netcdf-c
int
nc_http_read(CURL* curl, const char* objecturl, fileoffset_t start, fileoffset_t count, NCbytes* buf)
{
    int stat = NC_NOERR;
    char range[64];
    long httpcode = 200;
    CURLcode cstat = CURLE_OK;

    Trace("read");

    if(count == 0)
	goto done; /* do not attempt to read */

    if((stat = setupconn(curl,objecturl,buf)))
	goto fail;

    /* Set to read byte range */
    snprintf(range,sizeof(range),"%ld-%ld",(long)start,(long)((start+count)-1));
    cstat = CURLERR(curl_easy_setopt(curl, CURLOPT_RANGE, range));
    if(cstat != CURLE_OK)
        {stat = NC_ECURL; goto done;}

    if((stat = execute(curl,GETCMD,&httpcode)))
	goto done;

done:
dbgflush();
    return stat;

fail:
    stat = NC_ECURL;
    goto done;
}
コード例 #3
0
ファイル: fault.c プロジェクト: jameshilliard/WECB-BH-GPL
 void dump_core(void)
{
	static bool called;

	if (called) {
		DEBUG(0, ("dump_core() called recursive\n"));
		exit(1);
	}
	called = true;

	/* Note that even if core dumping has been disabled, we still set up
	 * the core path. This is to handle the case where core dumping is
	 * turned on in smb.conf and the relevant daemon is not restarted.
	 */
	if (!lp_enable_core_files()) {
		DEBUG(0, ("Exiting on internal error (core file administratively disabled)\n"));
		exit(1);
	}

#if DUMP_CORE
	/* If we're running as non root we might not be able to dump the core
	 * file to the corepath.  There must not be an unbecome_root() before
	 * we call abort(). */
	if (geteuid() != 0) {
		become_root();
	}

	if (*corepath != '\0') {
		/* The chdir might fail if we dump core before we finish
		 * processing the config file.
		 */
		if (chdir(corepath) != 0) {
			DEBUG(0, ("unable to change to %s\n", corepath));
			DEBUGADD(0, ("refusing to dump core\n"));
			exit(1);
		}

		DEBUG(0,("dumping core in %s\n", corepath));
	}

	umask(~(0700));
	dbgflush();

	/* Ensure we don't have a signal handler for abort. */
#ifdef SIGABRT
	CatchSignal(SIGABRT,SIGNAL_CAST SIG_DFL);
#endif

	abort();

#else /* DUMP_CORE */
	exit(1);
#endif /* DUMP_CORE */
}
コード例 #4
0
ファイル: dhttp.c プロジェクト: Unidata/netcdf-c
int
nc_http_close(void* curl0)
{
    int stat = NC_NOERR;
    CURL* curl = curl0;

    Trace("close");

    if(curl != NULL)
	(void)curl_easy_cleanup(curl);
dbgflush();
    return stat;
}
コード例 #5
0
ファイル: dhttp.c プロジェクト: Unidata/netcdf-c
int
nc_http_open(const char* objecturl, void** curlp, long long* filelenp)
{
    int stat = NC_NOERR;
    CURL* curl = NULL;
    int i;
    NClist* list = NULL; 

    Trace("open");

    /* initialize curl*/
    curl = curl_easy_init();
    if (curl == NULL) stat = NC_ECURL;
    if(curlp && curl) *curlp = (void*)curl;
    if(filelenp) {
	*filelenp = -1;
        /* Attempt to get the file length using HEAD */
	list = nclistnew();
	if((stat = setupconn(curl,objecturl,NULL))) goto done;
	if((stat = headerson(curl,list))) goto done;
	if((stat = execute(curl,HEADCMD,NULL))) goto done;
	headersoff(curl);
	for(i=0;i<nclistlength(list);i+=2) {
	    char* s = nclistget(list,i);
	    if(strcasecmp(s,"content-length")==0) {
	        s = nclistget(list,i+1);
		sscanf(s,"%lld",filelenp);
		break;
	    }
	    /* Also check for the Accept-Ranges header */ 
	    if(strcasecmp(s,"accept-ranges")==0) {
	        s = nclistget(list,i+1);
		if(strcasecmp(s,"bytes")!=0) /* oops! */
		    {stat = NC_EACCESS; goto done;}
	    }
	}
    }  
done:
    nclistfreeall(list);
dbgflush();
    return stat;
}
コード例 #6
0
ファイル: dhttp.c プロジェクト: Unidata/netcdf-c
static void
Trace(const char* fcn)
{
    fprintf(stdout,"xxx: %s\n",fcn);
    dbgflush();
}