{
char new_path[PATH_MAX];
- snprintf(new_path, PATH_MAX, "%s%s/", path, entry->name);
+ snprintf(new_path, sizeof(new_path), "%s%s/", path, entry->name);
dump(entry, new_path);
}
}
{
char buf[PATH_MAX];
- snprintf(buf, PATH_MAX, "/tmp/%d-%d-%s", getpid(),
+ snprintf(buf, sizeof(buf), "/tmp/%d-%d-%s", getpid(),
efreet_desktop_command_file_id++, base);
f->fullpath = strdup(buf);
f->pending = 1;
EINA_LIST_FOREACH(xdg_dirs, l, dir)
{
- snprintf(path, PATH_MAX, "%s/icons", dir);
+ snprintf(path, sizeof(path), "%s/icons", dir);
icon = efreet_icon_fallback_dir_scan(path, icon_name);
if (icon)
{
EINA_LIST_FOREACH(xdg_dirs, l, dir)
{
- snprintf(path, PATH_MAX, "%s/pixmaps", dir);
+ snprintf(path, sizeof(path), "%s/pixmaps", dir);
icon = efreet_icon_fallback_dir_scan(path, icon_name);
if (icon)
{
/* XXX if the return from kde-config is a line longer than PATH_MAX,
* this won't be correct (increase buffer and get the rest...) */
- if (!fgets(buf, PATH_MAX, f))
+ if (!fgets(buf, sizeof(buf), f))
{
ERR("Error initializing KDE legacy information");
return 0;
}
/* don't merge the same path twice */
- if (eina_hash_find(efreet_merged_menus, realpath))
+ if (eina_hash_find(efreet_merged_menus, realpath))
+ {
+ FREE(realpath);
return 1;
+ }
eina_hash_add(efreet_merged_menus, realpath, (void *)1);
merge_xml = efreet_xml_new(realpath);
- FREE(realpath);
if (!merge_xml)
{
INF("efreet_menu_merge() failed to read in the "
"merge file (%s)", realpath);
+ FREE(realpath);
return 0;
}
+ FREE(realpath);
+
internal = efreet_menu_internal_new();
efreet_menu_path_set(internal, path);
efreet_menu_handle_menu(internal, merge_xml);
if (!p) continue;
if (strcmp(p, ".menu")) continue;
- snprintf(dir_path, PATH_MAX, "%s/%s", path, file->d_name);
+ snprintf(dir_path, sizeof(dir_path), "%s/%s", path, file->d_name);
if (!efreet_menu_merge(parent, xml, dir_path))
{
closedir(files);
if (prefix)
{
- snprintf(buf, PATH_MAX, "%s%s", prefix, file->d_name);
+ snprintf(buf, sizeof(buf), "%s%s", prefix, file->d_name);
filter->op->filenames = eina_list_append(filter->op->filenames, strdup(buf));
}
else
while ((file = readdir(files)))
{
if (!strcmp(file->d_name, ".") || !strcmp(file->d_name, "..")) continue;
- snprintf(buf, PATH_MAX, "%s/%s", path, file->d_name);
+ snprintf(buf, sizeof(buf), "%s/%s", path, file->d_name);
if (id)
- snprintf(buf2, PATH_MAX, "%s-%s", id, file->d_name);
+ snprintf(buf2, sizeof(buf2), "%s-%s", id, file->d_name);
else
strcpy(buf2, file->d_name);
while ((file = readdir(files)))
{
if (!strcmp(file->d_name, ".") || !strcmp(file->d_name, "..")) continue;
- snprintf(buf, PATH_MAX, "%s/%s", path, file->d_name);
+ snprintf(buf, sizeof(buf), "%s/%s", path, file->d_name);
if (relative_path)
- snprintf(buf2, PATH_MAX, "%s/%s", relative_path, file->d_name);
+ snprintf(buf2, sizeof(buf2), "%s/%s", relative_path, file->d_name);
else
strcpy(buf2, file->d_name);
* We watch the directories so we can watch for new files
*/
datadir = datahome;
- snprintf(buf, PATH_MAX, "%s/mime", datadir);
+ snprintf(buf, sizeof(buf), "%s/mime", datadir);
efreet_mime_monitor_add(buf);
EINA_LIST_FOREACH(datadirs, l, datadir)
{
- snprintf(buf, PATH_MAX, "%s/mime", datadir);
+ snprintf(buf, sizeof(buf), "%s/mime", datadir);
efreet_mime_monitor_add(buf);
}
efreet_mime_monitor_add("/etc/mime.types");
if (!uri || !uri->path || !ecore_file_can_write(uri->path)) return 0;
fname = ecore_file_file_get(uri->path);
- snprintf(dest, PATH_MAX, "%s/files/%s", efreet_trash_dir_get(), fname);
+ snprintf(dest, sizeof(dest), "%s/files/%s", efreet_trash_dir_get(), fname);
/* search for a free filename */
while (ecore_file_exists(dest))
- snprintf(dest, PATH_MAX, "%s/files/%s$%d",
+ snprintf(dest, sizeof(dest), "%s/files/%s$%d",
efreet_trash_dir_get(), fname, i++);
fname = ecore_file_file_get(dest);
}
/* create info file */
- snprintf(dest, PATH_MAX, "%s/info/%s.trashinfo",
+ snprintf(dest, sizeof(dest), "%s/info/%s.trashinfo",
efreet_trash_dir_get(), fname);
if ((f = fopen(dest, "w")))
efreet_trash_is_empty(void)
{
char buf[PATH_MAX];
- snprintf(buf, PATH_MAX, "%s/files", efreet_trash_dir_get());
-
+
+ snprintf(buf, sizeof(buf), "%s/files", efreet_trash_dir_get());
+
/* TODO Check also trash in other filesystems */
return ecore_file_dir_is_empty(buf);
}
{
char buf[PATH_MAX];
- snprintf(buf, PATH_MAX, "%s/info", efreet_trash_dir_get());
+ snprintf(buf, sizeof(buf), "%s/info", efreet_trash_dir_get());
if (!ecore_file_recursive_rm(buf)) return 0;
ecore_file_mkdir(buf);
- snprintf(buf, PATH_MAX, "%s/files", efreet_trash_dir_get());
+ snprintf(buf, sizeof(buf), "%s/files", efreet_trash_dir_get());
if (!ecore_file_recursive_rm(buf)) return 0;
ecore_file_mkdir(buf);
// NOTE THIS FUNCTION NOW IS NOT COMPLETE AS I DON'T NEED IT
// TODO read the name from the infofile instead of the filename
- snprintf(buf, PATH_MAX, "%s/files", efreet_trash_dir_get());
+ snprintf(buf, sizeof(buf), "%s/files", efreet_trash_dir_get());
files = ecore_file_ls(buf);
EINA_LIST_FOREACH(files, l, infofile)
if (!file) break;
if (!strcmp(file->d_name, ".") || !strcmp(file->d_name, "..")) continue;
- snprintf(buf, PATH_MAX, "%s/%s", fill->current->path, file->d_name);
+ snprintf(buf, sizeof(buf), "%s/%s", fill->current->path, file->d_name);
if (fill->current->file_id)
- snprintf(file_id, PATH_MAX, "%s-%s", fill->current->file_id, file->d_name);
+ snprintf(file_id, sizeof(file_id), "%s-%s", fill->current->file_id, file->d_name);
else
strcpy(file_id, file->d_name);
if (!exten) continue;
if (strcmp(".menu", exten)) continue;
- snprintf(fbuf, PATH_MAX, "%s/%s", dbuf, file->d_name);
+ snprintf(fbuf, sizeof(fbuf), "%s/%s", dbuf, file->d_name);
if (ecore_file_is_dir(fbuf)) continue;
menus = eina_list_append(menus, strdup(fbuf));