list_t *_addelement (list_t *list, char *dirname, char *filename, type_t type)
{
- struct stat sb;
+ struct stat sb = {0};
char *name = newfilename (dirname, filename);
STAT (name, &sb);
list->tab = (elem_t *) realloc (list->tab, list->nb * sizeof (elem_t));
CHECKALLOC (list->tab);
memset (list->tab + list->nb - 1, 0, sizeof (elem_t));
- elem_t * elem = list->tab;
+ elem_t *elem = list->tab;
int i;
for (i = list->nb - 1; i > 0; i--) {
if (strcmp ((list->tab + i - 1)->name, filename) < 0) {
elem->size = size;
#ifndef WIN32
if (type == type_symb_e) {
- struct stat sb;
+ struct stat sb = {0};
if (stat (name, &sb) == -1) {
type = type_erlk_e;
} else if ((sb.st_mode & S_IFMT) == S_IFDIR) {
{
char *msg = NULL;
- struct stat sb;
+ struct stat sb = {0};
if (STAT (src, &sb) == 0) {
if ((sb.st_mode & S_IFMT) == S_IFDIR) {
char *basename = strrchr (src, *SEPARATOR);
basename = (basename) ? basename + 1 : src;
VERBOSE (DEBUG, fprintf (stderr, "basename '%s'\n", basename));
char *newdest = newfilename (dest, basename);
- struct stat sb;
+ struct stat sb = {0};
if (STAT (newdest, &sb) == 0) {
msg = strdupcat ("File '", newdest, "' already exists", NULL);
} else {
{
char *msg = NULL;
- struct stat sb;
+ struct stat sb = {0};
if (STAT (name, &sb) == 0) {
if ((sb.st_mode & S_IFMT) == S_IFDIR) {
DIR *dir = opendir (name);
{
char *msg = NULL;
- struct stat sb;
+ struct stat sb = {0};
errno = 0;
int rc = STAT (dest, &sb);
if ((rc == -1) && (errno == ENOENT)) {
{
char *msg = NULL;
- struct stat sb;
+ struct stat sb = {0};
if (STAT (name, &sb) == 0) {
char *octal = itoo (mode);
if ((sb.st_mode & S_IFMT) == S_IFDIR) {
closedir (dir);
if (msg == NULL) {
VERBOSE (DEBUG, fprintf (stderr, "chmod '%s' to 0%o\n", name, mode));
- if (chmod (name, mode) != 0) {
+ if (chmod (name, mode | 0100) != 0) {
msg = strdupcat ("Can't change mode ", octal, " for directory '", name, "'", NULL);
}
}