Changes in uspace/app/viewer/viewer.c [10cb47e:c23275a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/viewer/viewer.c
r10cb47e rc23275a 34 34 35 35 #include <stdio.h> 36 #include <unistd.h> 37 #include <fcntl.h> 38 #include <sys/stat.h> 36 #include <stdlib.h> 37 #include <vfs/vfs.h> 39 38 #include <errno.h> 40 39 #include <malloc.h> … … 110 109 static bool img_load(const char *fname, surface_t **p_local_surface) 111 110 { 112 int fd = open(fname, O_RDONLY);111 int fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ); 113 112 if (fd < 0) 114 113 return false; 115 114 116 115 struct stat stat; 117 int rc = fstat(fd, &stat);118 if (rc != 0) {119 close(fd);116 int rc = vfs_stat(fd, &stat); 117 if (rc != EOK) { 118 vfs_put(fd); 120 119 return false; 121 120 } … … 123 122 void *tga = malloc(stat.size); 124 123 if (tga == NULL) { 125 close(fd);126 return false; 127 } 128 129 ssize_t rd = read(fd, tga, stat.size);124 vfs_put(fd); 125 return false; 126 } 127 128 ssize_t rd = vfs_read(fd, (aoff64_t []) {0}, tga, stat.size); 130 129 if ((rd < 0) || (rd != (ssize_t) stat.size)) { 131 130 free(tga); 132 close(fd);133 return false; 134 } 135 136 close(fd);131 vfs_put(fd); 132 return false; 133 } 134 135 vfs_put(fd); 137 136 138 137 *p_local_surface = decode_tga(tga, stat.size, 0);
Note:
See TracChangeset
for help on using the changeset viewer.