fpopen.c:

Add support for the '&' flag, which redirects stderr to the FILE *.
TODO:
  New set of TODO items....
bitmap-optimize
Theodore Ts'o 1999-06-18 01:13:31 +00:00
parent d4b0ce0316
commit e2e69ba455
2 changed files with 74 additions and 2 deletions

50
TODO
View File

@ -4,4 +4,52 @@ BTW: Could you please add some sort of deleted and possibly corrupted file
and inode list to e2fsck report. There should be filenames deleted
from directory inodes, files with duplicate blocks e.t.c.
It's pretty annoying to filter this information from e2fsck output
by hand :-(
by hand :-
------------------------------------------
Add a "answer Yes always to this class of question" response.
----------------------------------
ext2fs_flush() should return a different error message for primary
versus backup superblock flushing, so that mke2fs can print an
appropriate error message.
-----------------------------------
Put code into e2fsck to support imagic inodes....
---------------------------------
Deal with the case where /lost+found isn't a directory....
--------------------------------------
Date: Mon, 08 Mar 1999 21:46:14 +0100
From: Sergio Polini <s.polini@mclink.it>
I'm reading the sorce code of e2fsck 1.14.
In pass2.c, lines 352-357, I read:
if ((dirent->name_len & 0xFF) > EXT2_NAME_LEN) {
if (fix_problem(ctx, PR_2_FILENAME_LONG, &cd->pctx)) {
dirent->name_len = EXT2_NAME_LEN;
dir_modified++;
}
}
I think that I'll never see any messages about too long filenames,
because "whatever & 0xFF" can never be "> 0xFF".
Am I wrong?
--------------------------------------
debugfs --- ls of a corrupt directory (or a non-directory inode) with
inconsistent lengths can cause it to core dump! Should fix to make it
more robust.
-------------------------------------

View File

@ -1,6 +1,24 @@
/*
* fpopen.c --- unlike the libc popen, it directly executes the
* command instead of call out to the shell.
*
* Copyright Theodore Ts'o, 1996-1999.
*
* Permission to use this file is granted for any purposes, as long as
* this copyright statement is kept intact and the author is not held
* liable for any damages resulting from the use of this program.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE.
*/
#include <unistd.h>
@ -20,7 +38,7 @@ FILE *fpopen(const char *cmd, const char *mode)
int i = 0;
char *buf, *prog = 0;
char *p;
int do_stdin;
int do_stdin, do_stderr = 0;
int fds[2];
pid_t pid;
@ -40,6 +58,10 @@ FILE *fpopen(const char *cmd, const char *mode)
errno = EINVAL;
return NULL;
}
switch (*(mode+1)) {
case '&':
do_stderr = 1;
}
/*
* Create the argv vector....
@ -81,6 +103,8 @@ FILE *fpopen(const char *cmd, const char *mode)
} else {
close(fds[0]);
dup2(fds[1], 1);
if (do_stderr)
dup2(fds[1], 2);
}
(void) execvp(prog, argv);
perror(prog);