Changeset 8e3498b in mainline for uspace/app/sysinst/futil.c
- Timestamp:
- 2017-12-04T18:44:24Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bde5c04
- Parents:
- 40feeac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sysinst/futil.c
r40feeac r8e3498b 57 57 { 58 58 int sf, df; 59 s size_t nr, nw;59 size_t nr, nw; 60 60 int rc; 61 61 aoff64_t posr = 0, posw = 0; … … 72 72 73 73 do { 74 nr = vfs_read(sf, &posr, buf, BUF_SIZE); 74 rc = vfs_read(sf, &posr, buf, BUF_SIZE, &nr); 75 if (rc != EOK) 76 goto error; 75 77 if (nr == 0) 76 78 break; 77 if (nr < 0) 78 return EIO; 79 80 nw = vfs_write(df, &posw, buf, nr); 81 if (nw <= 0) 82 return EIO; 83 } while (true); 79 80 rc= vfs_write(df, &posw, buf, nr, &nw); 81 if (rc != EOK) 82 goto error; 83 84 } while (nr == BUF_SIZE); 84 85 85 86 (void) vfs_put(sf); … … 90 91 91 92 return EOK; 93 error: 94 vfs_put(sf); 95 vfs_put(df); 96 return rc; 92 97 } 93 98 … … 156 161 { 157 162 int sf; 158 ssize_t nr; 163 size_t nr; 164 int rc; 159 165 size_t fsize; 160 166 char *data; … … 168 174 vfs_put(sf); 169 175 return EIO; 170 } 176 } 171 177 172 178 fsize = st.size; … … 178 184 } 179 185 180 nr = vfs_read(sf, (aoff64_t []) { 0 }, data, fsize);181 if ( nr != (ssize_t)fsize) {186 rc = vfs_read(sf, (aoff64_t []) { 0 }, data, fsize, &nr); 187 if (rc != EOK || nr != fsize) { 182 188 vfs_put(sf); 183 189 free(data);
Note:
See TracChangeset
for help on using the changeset viewer.