X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fiface-file.c;h=78c4e0b901448b2d1996bacef83f184cbf148656;hb=774bac9fbb03ef8bf7c2ca2c79a8b87c9bc4c526;hp=1e3d1ad1950e025acf6cfd7711fca6cba3d85624;hpb=1f8ac11d4550b1113d9a8c23e62b236cb8ad8404;p=palacios.git diff --git a/linux_module/iface-file.c b/linux_module/iface-file.c index 1e3d1ad..78c4e0b 100644 --- a/linux_module/iface-file.c +++ b/linux_module/iface-file.c @@ -161,7 +161,7 @@ static int palacios_file_mkdir(const char * pathname, unsigned short perms, int { dentry = kern_path_create(AT_FDCWD, pathname, &tmp_path, 1); - if (IS_ERR(dentry)) { + if (!dentry || IS_ERR(dentry)) { return 0; } @@ -170,7 +170,7 @@ static int palacios_file_mkdir(const char * pathname, unsigned short perms, int #endif - if (!IS_ERR(dentry)) { + if (!(!dentry || IS_ERR(dentry))) { ret = vfs_mkdir(path_ptr->dentry->d_inode, dentry, perms); } @@ -220,7 +220,7 @@ static void * palacios_file_open(const char * path, int mode, void * private_dat pfile->filp = filp_open(path, pfile->mode, 0); - if (IS_ERR(pfile->filp)) { + if (!pfile->filp || IS_ERR(pfile->filp)) { ERROR("Cannot open file: %s\n", path); palacios_free(pfile); return NULL; @@ -252,6 +252,10 @@ static void * palacios_file_open(const char * path, int mode, void * private_dat static int palacios_file_close(void * file_ptr) { struct palacios_file * pfile = (struct palacios_file *)file_ptr; + if (!pfile) { + return -1; + } + filp_close(pfile->filp, NULL); list_del(&(pfile->file_node));