these questions are related to util.c in setup repo:
in function data_new(void) from util.c:
data_t *data_new(void)
{
data_t *data=NULL;
data = (data_t*)malloc(sizeof(data_t));
if(data==NULL)
return(NULL);
data->name=NULL;
data->data=NULL;
return(data);
}
what is the use of this test:
if(data==NULL) return(NULL);
??
it seems unused to me.
--------------------------------------------
why not use
int rmrf(char *path)
{
system(g_strdup_printf("rm -rf %s", path));
}
instead of
/* does the same thing as 'rm -rf' */
int rmrf(char *path)
{
int errflag = 0;
struct dirent *dp;
DIR *dirp;
char name[PATH_MAX];
if(!unlink(path))
return(0);
else
{
if(errno == ENOENT)
return(0);
else if(errno == EPERM)
{
/* fallthrough */
}
else if(errno == EISDIR)
{
/* fallthrough */
}
else if(errno == ENOTDIR)
return(1);
else
/* not a directory */
return(1);
if((dirp = opendir(path)) == (DIR *)-1)
return(1);
for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
if(dp->d_ino)
{
sprintf(name, "%s/%s", path, dp->d_name);
if(strcmp(dp->d_name, "..") && strcmp(dp->d_name, "."))
errflag += rmrf(name);
}
closedir(dirp);
if(rmdir(path))
errflag++;
return(errflag);
}
return(0);
}
?? since it's a forced removal anyway.
--------------------------------------------
in
int umount_if_needed(char *sourcedir)
would it be enough to umount the sourcedir instead of looking for it's
device and just then umounting its device?
see
http://www.die.net/doc/linux/man/man2/umount.2.html
--
In order to be effective truth must penetrate like an arrow - and that
is likely to hurt. 'Posthumous Pieces' by Wei Wu Wei
_______________________________________________
Frugalware-devel mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-devel