Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163588256
D17586.id52050.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D17586.id52050.diff
View Options
Index: head/sbin/fsck_ffs/fsutil.c
===================================================================
--- head/sbin/fsck_ffs/fsutil.c
+++ head/sbin/fsck_ffs/fsutil.c
@@ -576,9 +576,7 @@
slowio_start();
totalreads++;
diskreads++;
- if (lseek(fd, offset, 0) < 0)
- rwerror("SEEK BLK", blk);
- else if (read(fd, buf, (int)size) == size) {
+ if (pread(fd, buf, (int)size, offset) == size) {
if (bkgrdflag)
slowio_end();
return (0);
@@ -595,14 +593,11 @@
} else
rwerror("READ BLK", blk);
- if (lseek(fd, offset, 0) < 0)
- rwerror("SEEK BLK", blk);
errs = 0;
memset(buf, 0, (size_t)size);
printf("THE FOLLOWING DISK SECTORS COULD NOT BE READ:");
for (cp = buf, i = 0; i < size; i += secsize, cp += secsize) {
- if (read(fd, cp, (int)secsize) != secsize) {
- (void)lseek(fd, offset + i + secsize, 0);
+ if (pread(fd, cp, (int)secsize, offset + i) != secsize) {
if (secsize != dev_bsize && dev_bsize != 1)
printf(" %jd (%jd),",
(intmax_t)(blk * dev_bsize + i) / secsize,
@@ -629,22 +624,16 @@
return;
offset = blk;
offset *= dev_bsize;
- if (lseek(fd, offset, 0) < 0)
- rwerror("SEEK BLK", blk);
- else if (write(fd, buf, size) == size) {
+ if (pwrite(fd, buf, size, offset) == size) {
fsmodified = 1;
return;
}
resolved = 0;
rwerror("WRITE BLK", blk);
- if (lseek(fd, offset, 0) < 0)
- rwerror("SEEK BLK", blk);
printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:");
for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
- if (write(fd, cp, dev_bsize) != dev_bsize) {
- (void)lseek(fd, offset + i + dev_bsize, 0);
+ if (pwrite(fd, cp, dev_bsize, offset + i) != dev_bsize)
printf(" %jd,", (intmax_t)blk + i / dev_bsize);
- }
printf("\n");
return;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jul 25, 6:19 PM (19 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35483454
Default Alt Text
D17586.id52050.diff (1 KB)
Attached To
Mode
D17586: Make fsck(8) use pread(2)
Attached
Detach File
Event Timeline
Log In to Comment