OpenVAS Libraries  7.0.9
Functions
openvas_file.c File Reference

File utilities. More...

#include "openvas_file.h"
#include <errno.h>
#include <sys/stat.h>
#include <glib/gstdio.h>

Functions

int openvas_file_check_is_dir (const char *name)
 Checks whether a file is a directory or not. More...
 
int openvas_file_remove_recurse (const gchar *pathname)
 Recursively removes files and directories. More...
 
gboolean openvas_file_copy (const gchar *source_file, const gchar *dest_file)
 Copies a source file into a destination file. More...
 
gboolean openvas_file_move (const gchar *source_file, const gchar *dest_file)
 Moves a source file into a destination file. More...
 

Detailed Description

File utilities.

Function Documentation

int openvas_file_check_is_dir ( const char *  name)

Checks whether a file is a directory or not.

This is a replacement for the g_file_test functionality which is reported to be unreliable under certain circumstances, for example if this application and glib are compiled with a different libc.

Symbolic links are not followed.

Parameters
[in]nameName of file or directory.
Returns
1 if parameter is directory, 0 if it is not, -1 if it does not exist or could not be accessed.
gboolean openvas_file_copy ( const gchar *  source_file,
const gchar *  dest_file 
)

Copies a source file into a destination file.

If the destination file does exist already, it will be overwritten.

Parameters
[in]source_fileSource file name.
[in]dest_fileDestination file name.
Returns
TRUE if successful, FALSE otherwise.
gboolean openvas_file_move ( const gchar *  source_file,
const gchar *  dest_file 
)

Moves a source file into a destination file.

If the destination file does exist already, it will be overwritten.

Parameters
[in]source_fileSource file name.
[in]dest_fileDestination file name.
Returns
TRUE if successful, FALSE otherwise.
int openvas_file_remove_recurse ( const gchar *  pathname)

Recursively removes files and directories.

This function will recursively call itself to delete a path and any contents of this path.

Parameters
[in]pathnameThe name of the file to be deleted from the filesystem.
Returns
0 if the name was successfully deleted, -1 if an error occurred. Please note that errno is currently not guaranteed to contain the correct value if -1 is returned.
Todo:
Set errno when we return -1 to maintain remove() compatibility.