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>
|
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
|
* e2fsck.8.in: Add explanation that you can use mke2fs -n -b
|
||||||
blocksize to printout alternate superblock locations.
|
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)
|
static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
|
||||||
{
|
{
|
||||||
int flush = 0;
|
int flush = 0;
|
||||||
int c;
|
int c, fd;
|
||||||
#ifdef MTRACE
|
#ifdef MTRACE
|
||||||
extern void *mallwatch;
|
extern void *mallwatch;
|
||||||
#endif
|
#endif
|
||||||
@ -483,6 +483,17 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
|
|||||||
case 'C':
|
case 'C':
|
||||||
ctx->progress = e2fsck_update_progress;
|
ctx->progress = e2fsck_update_progress;
|
||||||
ctx->progress_fd = atoi(optarg);
|
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;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
case 'a':
|
case 'a':
|
||||||
|
Loading…
Reference in New Issue
Block a user