All pastes #30373 Raw Edit

neuron

public text v1 · immutable
#30373 ·published 2005-11-22 20:45 UTC
rendered paste body
	filedata_h *filedata = malloc(sizeof(filedata_h));
	
	// DEBUG CHECK: errno = 0;
	errno = 0;
	filedata->fd = open(full, fi->flags);
	if (filedata->fd == -1) {
		free(filedata);
		return -errno;
	}
	
	// TEMPORARY CHECK, this causes fstat to fail.... WHY?!?
	// Filedata isn't added to the database yet, so what the hell else can access this?!?
	syslog(LOG_DEBUG,"errno set after open : %d, fd : %d, %s\n",errno,filedata->fd,strerror(errno));
	usleep(20000);
	
	res = fstat(filedata->fd,&statbuf);
	if (res == -1) {
		syslog(LOG_ERR,"fstat on file failed after open was ok!, fd %d, strerror : %s\n",filedata->fd,strerror(errno));
		exit(EXIT_FAILURE);
	}