}
+/*************************************************************************
+ * Start of yaffsfs visible functions.
+ *************************************************************************/
+
int yaffs_dup(int fd)
{
int newHandle = -1;
if(newHandle >= 0)
newPtr = yaffsfs_GetHandlePointer(newHandle);
- if(newPtr){
+ if(newPtr)
*newPtr = *oldPtr;
- return newHandle;
- }
+
+ yaffsfs_Unlock();
if(!oldPtr)
yaffsfs_SetError(-EBADF);
- else
+ else if (!newPtr)
yaffsfs_SetError(-ENOMEM);
- return -1;
+ return newHandle;
}
int notDir = 0;
int loop = 0;
+ if(!path) {
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
unsigned int maxRead;
u8 *buf = (u8 *)vbuf;
+ if(!vbuf){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
yaffsfs_Lock();
h = yaffsfs_GetHandlePointer(fd);
obj = yaffsfs_GetHandleObject(fd);
int nToWrite = 0;
const u8 *buf = (const u8 *)vbuf;
+ if(!vbuf){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
yaffsfs_Lock();
h = yaffsfs_GetHandlePointer(fd);
obj = yaffsfs_GetHandleObject(fd);
int notDir = 0;
int loop = 0;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int notDir = 0;
int loop = 0;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
YCHAR *alt_newpath=NULL;
+ if(!oldPath || !newPath){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(newPath) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int notDir = 0;
int loop = 0;
+ if(!path || !buf){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int retVal = -1;
+ if(!buf){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
yaffsfs_Lock();
obj = yaffsfs_GetHandleObject(fd);
/* xattrib functions */
-static int yaffs_do_setxattr(const YCHAR *path, const char *name, const void *data, int size, int flags, int follow)
+static int yaffs_do_setxattr(const YCHAR *path, const char *name,
+ const void *data, int size, int flags, int follow)
{
struct yaffs_obj *obj;
struct yaffs_obj *dir;
int retVal = -1;
+ if(!path || !name || !data){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int retVal = -1;
+ if(!name || !data){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
yaffsfs_Lock();
obj = yaffsfs_GetHandleObject(fd);
int notDir = 0;
int loop = 0;
+ if(!path || !name || !data ){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int retVal = -1;
+ if(!name || !data ){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
yaffsfs_Lock();
obj = yaffsfs_GetHandleObject(fd);
int notDir = 0;
int loop = 0;
+ if(!path || !data ){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int retVal = -1;
+ if(!data ){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
yaffsfs_Lock();
obj = yaffsfs_GetHandleObject(fd);
int loop = 0;
int retVal = -1;
+ if(!path || !name){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int retVal = -1;
+ if(!name){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
yaffsfs_Lock();
obj = yaffsfs_GetHandleObject(fd);
int loop = 0;
int retval = -1;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int notDir = 0;
int loop = 0;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int notDir = 0;
int loop = 0;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int result;
YCHAR *alt_path;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int result=YAFFS_FAIL;
struct yaffs_dev *dev=NULL;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
T(YAFFS_TRACE_MOUNT,(TSTR("yaffs: Mounting %s" TENDSTR),path));
if(yaffsfs_CheckPath(path) < 0){
struct yaffs_dev *dev=NULL;
YCHAR *dummy;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
struct yaffs_dev *dev=NULL;
yaffsfs_Handle *yh;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int retVal=-1;
struct yaffs_dev *dev=NULL;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
struct yaffs_dev *dev=NULL;
YCHAR *dummy;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
struct yaffs_dev *dev=NULL;
YCHAR *dummy;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int notDir = 0;
int loop = 0;
+ if(!dirname){
+ yaffsfs_SetError(-EFAULT);
+ return NULL;
+ }
+
if(yaffsfs_CheckPath(dirname) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return NULL;
{
yaffsfs_DirectorySearchContext *dsc = (yaffsfs_DirectorySearchContext *)dirp;
+ if(!dsc){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
yaffsfs_Lock();
dsc->magic = 0;
list_del(&dsc->others); /* unhook from list */
int notDir = 0;
int loop = 0;
+ if(!oldpath || !newpath){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(newpath) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
int notDir = 0;
int loop = 0;
+ if(!path || !buf){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
yaffsfs_Lock();
obj = yaffsfs_FindObject(NULL,path,0,1, &dir,¬Dir,&loop);
int lnkLoop = 0;
YCHAR *newname;
+ if(!oldpath || !linkpath){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(linkpath) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
{
struct yaffs_obj *obj;
+ if(!path){
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
if(yaffsfs_CheckPath(path) < 0){
yaffsfs_SetError(-ENAMETOOLONG);
return -1;