Пример #1
0
stat(char  * __path, struct stat * __statbuf)
{
	/* unknown */ void  ebx;
	/* unknown */ void  esi;



    eax = _xstat(1, __path, __statbuf);
}
Пример #2
0
Файл: path.c Проект: pedrox/kmod
TS_EXPORT int __xstat(int ver, const char *path, struct stat *st)
{
	const char *p;
	char buf[PATH_MAX * 2];
	static int (*_xstat)(int __ver, const char *__filename,
						struct stat *__stat_buf);

	if (!get_rootpath(__func__))
		return -1;

	_xstat = get_libc_func("__xstat");

	p = trap_path(path, buf);
	if (p == NULL)
		return -1;

	return _xstat(ver, p, st);
}
Пример #3
0
char *encode_base64_from_file(char *filename)
{
	base64_encodestate enstate;
	statstruct statb;	
	FILE *fp=NULL;
	size_t size=0,size1=0;
	char *temp=NULL;
	char *temp1=NULL;
	char *base64_result=NULL;

#if !defined(LINUX_SUSE6_1)
	if(stat(filename,&statb)!=(-1))
#else
	if(_xstat(_STAT_VER,filename,&statb)!=(-1))
#endif
	{
		if(statb.st_size>0)
		{
			fp=fopen(filename,"rb");
			if(fp!=NULL)
			{
				size=statb.st_size;
				temp=(char *)Rmalloc(size+1);
				memset(temp,0,size+1);
				printf("size [%d]\n",size);
				size=fread(temp,sizeof(char),size,fp);
				printf("size [%d]\n",size);
				if(ferror(fp))
				{
					prterr("Error:  Failed to read characters to the end of file [%s].",filename);
				}else if(size==0) {
					prterr("Error:  File [%s] is an empty or an error occurred.",filename);
				}else{
					/*
					size1=base64_encoded_size(temp,size);
					*/
					size1=(size*2);

					temp1=(char *)Rmalloc(size1+1);
					memset(temp1,0,size1+1);

					base64_result=(char *)Rmalloc(size1+1);
					memset(base64_result,0,size1+1);
					
					base64_init_encodestate(&enstate);
					base64_encode_block(temp,size,temp1,&enstate);
					sprintf(base64_result,"%s%s",base64_result,temp1);

					memset(temp1,0,size1+1);
					base64_encode_blockend(temp1,&enstate);
					sprintf(base64_result,"%s%s",base64_result,temp1);

					if(temp!=NULL) Rfree(temp);
					if(temp1!=NULL) Rfree(temp1);
					fclose(fp);
					return(base64_result);
				}
				if(temp!=NULL) Rfree(temp);
				fclose(fp);
			}else{
				prterr("Error:  Could not open file [%s] for encoding to base64.\n",filename);
			}
		}else{
			prterr("Error:  Zero sized file [%s] could not be used for encoding to base64.\n",filename);
		}
	}else{
		prterr("Error:  Could not stat file [%s], not attempting to open file.\n",filename);
	}
	return(NULL);
}
Пример #4
0
//
// Ditto without caching
//
int
lstat_nocache(const char *szPath, struct xstat *st, unsigned long dwType)
{
	return _xstat(szPath, st, dwType,
		FALSE/*bCache*/, FALSE/*bFollowSymlink*/);
}
Пример #5
0
//
// Replacement for lstat().  Called by glob.c and ls.c
//
int
xlstat(const char *szPath, struct xstat *st)
{
	return _xstat(szPath, st, DT_UNKNOWN,
		TRUE/*bCache*/, FALSE/*bFollowSymlink*/);
}