mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-12-25 09:49:28 +08:00
ChangeLog, unix.c:
unix.c (PRS): Validate the completion information file descriptor so that the completion bar won't get accidentally written onto the disk.
This commit is contained in:
parent
5f629b7491
commit
ae8160e692
@ -1,5 +1,9 @@
|
||||
2001-05-01 Theodore Tso <tytso@valinux.com>
|
||||
|
||||
* unix.c (PRS): Validate the completion information file
|
||||
descriptor so that the completion bar won't get
|
||||
accidentally written onto the disk.
|
||||
|
||||
* e2fsck.8.in: Add explanation that you can use mke2fs -n -b
|
||||
blocksize to printout alternate superblock locations.
|
||||
|
||||
|
@ -438,7 +438,7 @@ static void signal_progress_off(int sig)
|
||||
static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
|
||||
{
|
||||
int flush = 0;
|
||||
int c;
|
||||
int c, fd;
|
||||
#ifdef MTRACE
|
||||
extern void *mallwatch;
|
||||
#endif
|
||||
@ -483,6 +483,17 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
|
||||
case 'C':
|
||||
ctx->progress = e2fsck_update_progress;
|
||||
ctx->progress_fd = atoi(optarg);
|
||||
/* Validate the file descriptor to avoid disasters */
|
||||
fd = dup(ctx->progress_fd);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr,
|
||||
_("Error validating file descriptor %d: %s\n"),
|
||||
ctx->progress_fd,
|
||||
error_message(errno));
|
||||
fatal_error(ctx,
|
||||
_("Invalid completion information file descriptor"));
|
||||
} else
|
||||
close(fd);
|
||||
break;
|
||||
case 'p':
|
||||
case 'a':
|
||||
|
Loading…
Reference in New Issue
Block a user