Changeset 6efd162 in mainline
- Timestamp:
- 2015-04-05T07:50:32Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- eb94d84
- Parents:
- c0393db
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/isa/isa.c
rc0393db r6efd162 245 245 bool opened = false; 246 246 int fd; 247 size_t file_len; 248 size_t total_read = 0; 247 size_t len; 249 248 ssize_t r; 250 249 … … 257 256 opened = true; 258 257 259 file_len = lseek(fd, 0, SEEK_END);258 len = lseek(fd, 0, SEEK_END); 260 259 lseek(fd, 0, SEEK_SET); 261 if ( file_len == 0) {260 if (len == 0) { 262 261 ddf_msg(LVL_ERROR, "Configuration file '%s' is empty.", 263 262 conf_path); … … 265 264 } 266 265 267 buf = malloc( file_len + 1);266 buf = malloc(len + 1); 268 267 if (buf == NULL) { 269 268 ddf_msg(LVL_ERROR, "Memory allocation failed."); … … 271 270 } 272 271 273 do { 274 r = read(fd, &buf[total_read], file_len - total_read); 275 if (r < 0) { 276 ddf_msg(LVL_ERROR, "Unable to read file '%s'.", conf_path); 277 goto cleanup; 278 } 279 280 total_read += r; 281 } while (total_read < file_len); 282 283 buf[file_len] = 0; 272 r = read_all(fd, buf, len); 273 if (r < 0) { 274 ddf_msg(LVL_ERROR, "Unable to read file '%s'.", conf_path); 275 goto cleanup; 276 } 277 278 buf[len] = 0; 284 279 285 280 suc = true;
Note:
See TracChangeset
for help on using the changeset viewer.