rename fd to clarify usage

SVN revision: 54885
This commit is contained in:
Sebastian Dransfeld 2010-11-23 13:30:17 +00:00
parent 24703f1433
commit f6cb6541e3
2 changed files with 12 additions and 12 deletions

View File

@ -212,7 +212,7 @@ main(int argc, char **argv)
int priority = 0; int priority = 0;
char *dir = NULL; char *dir = NULL;
char *path; char *path;
int fd = -1, tmpfd, dirsfd = -1; int lockfd = -1, tmpfd, dirsfd = -1;
struct stat st; struct stat st;
int changed = 0; int changed = 0;
int i; int i;
@ -244,12 +244,12 @@ main(int argc, char **argv)
/* lock process, so that we only run one copy of this program */ /* lock process, so that we only run one copy of this program */
snprintf(file, sizeof(file), "%s/.efreet/desktop_data.lock", efreet_home_dir_get()); snprintf(file, sizeof(file), "%s/.efreet/desktop_data.lock", efreet_home_dir_get());
fd = open(file, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); lockfd = open(file, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
if (fd < 0) goto efreet_error; if (lockfd < 0) goto efreet_error;
memset(&fl, 0, sizeof(struct flock)); memset(&fl, 0, sizeof(struct flock));
fl.l_type = F_WRLCK; fl.l_type = F_WRLCK;
fl.l_whence = SEEK_SET; fl.l_whence = SEEK_SET;
if (fcntl(fd, F_SETLK, &fl) < 0) if (fcntl(lockfd, F_SETLK, &fl) < 0)
{ {
if (verbose) if (verbose)
{ {
@ -403,7 +403,7 @@ main(int argc, char **argv)
ecore_shutdown(); ecore_shutdown();
eet_shutdown(); eet_shutdown();
eina_shutdown(); eina_shutdown();
close(fd); close(lockfd);
return 0; return 0;
error: error:
if (dirsfd >= 0) close(dirsfd); if (dirsfd >= 0) close(dirsfd);
@ -415,6 +415,6 @@ efreet_error:
eet_error: eet_error:
eina_shutdown(); eina_shutdown();
eina_error: eina_error:
if (fd > 0) close(fd); if (lockfd >= 0) close(lockfd);
return 1; return 1;
} }

View File

@ -261,7 +261,7 @@ main(int argc, char **argv)
Eina_List *l = NULL; Eina_List *l = NULL;
Efreet_Icon_Theme *theme; Efreet_Icon_Theme *theme;
char *dir = NULL; char *dir = NULL;
int fd = -1, tmpfd; int lockfd = -1, tmpfd;
int changed = 0; int changed = 0;
int i; int i;
struct flock fl; struct flock fl;
@ -296,12 +296,12 @@ main(int argc, char **argv)
/* lock process, so that we only run one copy of this program */ /* lock process, so that we only run one copy of this program */
snprintf(file, sizeof(file), "%s/.efreet/icon_data.lock", efreet_home_dir_get()); snprintf(file, sizeof(file), "%s/.efreet/icon_data.lock", efreet_home_dir_get());
fd = open(file, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); lockfd = open(file, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
if (fd < 0) goto efreet_error; if (lockfd < 0) goto efreet_error;
memset(&fl, 0, sizeof(struct flock)); memset(&fl, 0, sizeof(struct flock));
fl.l_type = F_WRLCK; fl.l_type = F_WRLCK;
fl.l_whence = SEEK_SET; fl.l_whence = SEEK_SET;
if (fcntl(fd, F_SETLK, &fl) < 0) if (fcntl(lockfd, F_SETLK, &fl) < 0)
{ {
if (verbose) if (verbose)
{ {
@ -444,7 +444,7 @@ main(int argc, char **argv)
ecore_shutdown(); ecore_shutdown();
eet_shutdown(); eet_shutdown();
eina_shutdown(); eina_shutdown();
close(fd); close(lockfd);
return 0; return 0;
error: error:
printf("error\n"); printf("error\n");
@ -456,6 +456,6 @@ efreet_error:
eet_error: eet_error:
eina_shutdown(); eina_shutdown();
eina_error: eina_error:
if (fd > 0) close(fd); if (lockfd >= 0) close(lockfd);
return 1; return 1;
} }