diff options
author | Brian Cameron <brian.cameron@sun.com> | 2005-12-22 04:50:45 +0000 |
---|---|---|
committer | Brian Cameron <bcameron@src.gnome.org> | 2005-12-22 04:50:45 +0000 |
commit | 2be57792419c16f8468f5edd06443e53643ce98d (patch) | |
tree | f471a0e95100bd825dba2244d60e7a913817d382 /utils | |
parent | c9bf94f2cf5d4d57df907371464a925bddb0cfc6 (diff) | |
download | gdm-2be57792419c16f8468f5edd06443e53643ce98d.tar.gz |
Now use g_ stdio function like g_chmod instead of chmod. Fixes bug
2005-12-22 Brian Cameron <brian.cameron@sun.com>
* daemon/auth.c, daemon/display.c, daemon/errorgui.c,
daemon/filecheck.c, daemon/fstype.c, daemon/gdm-net.c,
daemon/gdm.[ch], daemon/gdmconfig.c, daemon/misc.c,
daemon/server.c, daemon/slave.c, daemon/verify-pam.c,
daemon/xdmcp.c, gui/gdmXnestchooser.c, gui/gdmchooser.c,
gui/gdmcommon.c, gui/gdmlogin.c, gui/gdmphotosetup.c,
gui/gdmsetup.c, gui/gdmuser.c, utils/gdmprefetch.c,
vicious-extensions/ve-config.c, vicious-extensions/ve-gnome.c,
vicious-extensions/ve-misc.[ch], vicious-extensions/ve-nongnome.c:
Now use g_ stdio function like g_chmod instead of chmod.
Fixes bug #310229.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/gdmprefetch.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/utils/gdmprefetch.c b/utils/gdmprefetch.c index 2d6bfc64..d37e2a66 100644 --- a/utils/gdmprefetch.c +++ b/utils/gdmprefetch.c @@ -38,45 +38,43 @@ doout(char *s) void *map; struct stat buf; - if (((fd = open(s, O_RDONLY)) < 0) || - (fstat(fd, &buf) < 0) || - ((map = mmap(NULL, buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == + if (((fd = open (s, O_RDONLY)) < 0) || + (fstat (fd, &buf) < 0) || + ((map = mmap (NULL, buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED)) { (void)close(fd); return (-1); } - (void)close(fd); - (void)msync(map, buf.st_size, MS_INVALIDATE); - (void)munmap(map, buf.st_size); + (void)close (fd); + (void)msync (map, buf.st_size, MS_INVALIDATE); + (void)munmap (map, buf.st_size); return (0); } #define SIZE 1024*128 int -doin(char *s) +doin (char *s) { int fd; char buffer[SIZE]; if ((fd = open(s, O_RDONLY)) < 0) { - fprintf(stderr, "fopen: %s %s\n", strerror(errno), s); + fprintf (stderr, "fopen: %s %s\n", strerror(errno), s); return (-1); } - while (read(fd, buffer, SIZE) != 0) + while (read (fd, buffer, SIZE) != 0) ; - (void)close(fd); + (void)close (fd); return (0); } - - int -main(int argc, char *argv[]) +main (int argc, char *argv[]) { FILE *fp = 0; int c, errflg = 0; @@ -84,8 +82,8 @@ main(int argc, char *argv[]) extern char *optarg; int i; - while ((c = getopt(argc, argv, "o:")) != -1) { - switch(c) { + while ((c = getopt (argc, argv, "o:")) != -1) { + switch (c) { case 'o': out = 1; @@ -98,27 +96,27 @@ main(int argc, char *argv[]) } if (errflg) { - fprintf(stderr, "usage: %s [-o] filename [filename]\n", + fprintf (stderr, "usage: %s [-o] filename [filename]\n", argv[0]); - exit(1); + exit (1); } for (; optind < argc; optind++) { - if ((argv[optind][0] == '@') && ((fp = fopen(argv[optind], "r")) == 0)) { + if ((argv[optind][0] == '@') && ((fp = fopen (argv[optind], "r")) == 0)) { char path[1024]; - if ((fp = fopen(&(argv[optind][1]), "r")) == 0) { - fprintf(stderr, "fopen: %s %s\n", strerror(errno), &argv[optind][1]); + if ((fp = fopen (&(argv[optind][1]), "r")) == 0) { + fprintf (stderr, "fopen: %s %s\n", strerror (errno), &argv[optind][1]); continue; } - while (fgets(path, sizeof(path), fp) != 0) { + while (fgets (path, sizeof (path), fp) != 0) { path[strlen(path) -1] = '\0'; if (!out) { - doin(path); + doin (path); } else { - doout(path); + doout (path); } } fclose (fp); @@ -131,12 +129,12 @@ main(int argc, char *argv[]) } if (!out) { - doin(argv[optind]); + doin (argv[optind]); } else { - doout(argv[optind]); + doout (argv[optind]); } } } - exit(0); + exit (0); } |