aboutsummaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorKirill Ponomarev <krion@FreeBSD.org>2004-02-24 21:55:22 +0000
committerKirill Ponomarev <krion@FreeBSD.org>2004-02-24 21:55:22 +0000
commit11ad482d5f67a4fdc76b69aee95d73883be45588 (patch)
tree72dee68c712118345552b0209acea8e1462de7c8 /sysutils
parent36f3f6d94cd45e61926857c6478de67898797be6 (diff)
downloadports-11ad482d5f67a4fdc76b69aee95d73883be45588.tar.gz
ports-11ad482d5f67a4fdc76b69aee95d73883be45588.zip
Notes
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/e2fsprogs/Makefile2
-rw-r--r--sysutils/e2fsprogs/files/fsck_ext2fs.c43
-rw-r--r--sysutils/e2fsprogs/files/patch-SIGINFO-e2fck_unix.c54
3 files changed, 93 insertions, 6 deletions
diff --git a/sysutils/e2fsprogs/Makefile b/sysutils/e2fsprogs/Makefile
index 965caacfbd00..b26452a5b7ca 100644
--- a/sysutils/e2fsprogs/Makefile
+++ b/sysutils/e2fsprogs/Makefile
@@ -7,7 +7,7 @@
PORTNAME= e2fsprogs
PORTVERSION= 1.35.w20040131
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
diff --git a/sysutils/e2fsprogs/files/fsck_ext2fs.c b/sysutils/e2fsprogs/files/fsck_ext2fs.c
index 115cccf162ec..6cbc7da8723d 100644
--- a/sysutils/e2fsprogs/files/fsck_ext2fs.c
+++ b/sysutils/e2fsprogs/files/fsck_ext2fs.c
@@ -6,21 +6,34 @@
*
* $FreeBSD$
*
+ * Upstream: $Id: fsck_ext2fs.c,v 1.2 2004/02/24 20:57:02 emma Exp $
+ *
* format: gindent -kr
*/
+#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <sys/wait.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+__attribute__ ((noreturn))
+static int die(const char *tag)
+{
+ perror(tag);
+ exit(EXIT_FAILURE);
+}
-int
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
- int ch, i = 1, force = 0;
+ int ch, i = 1, force = 0, status;
long block = 0;
enum { normal, preen, yes, no } mode = normal;
char *cmd[256];
+ pid_t pid;
cmd[0] = "/sbin/e2fsck";
while ((ch = getopt(argc, argv, "BFpfnyb:")) != -1) {
@@ -43,6 +56,8 @@ main(int argc, char **argv)
case 'B':
case 'F':
default:
+ fprintf(stderr, "%s: unknown option -%c\n",
+ argv[0], optopt);
exit(EXIT_FAILURE);
}
}
@@ -76,6 +91,24 @@ main(int argc, char **argv)
cmd[i++] = 0;
- (void)execv(cmd[0], cmd);
- exit(EXIT_FAILURE);
+ pid = fork();
+ switch (pid) {
+ case -1:
+ /* error */
+ die("fork");
+ break;
+ case 0:
+ /* child */
+ (void) execv(cmd[0], cmd);
+ perror("execve");
+ _exit(127);
+ default:
+ /* parent */
+ if (pid != waitpid(pid, &status, 0))
+ die("waitpid");
+ if (WIFSIGNALED(status)
+ || (WIFEXITED(status) && WEXITSTATUS(status) >= 4))
+ exit(EXIT_FAILURE);
+ }
+ exit(EXIT_SUCCESS);
}
diff --git a/sysutils/e2fsprogs/files/patch-SIGINFO-e2fck_unix.c b/sysutils/e2fsprogs/files/patch-SIGINFO-e2fck_unix.c
new file mode 100644
index 000000000000..fa10795ad942
--- /dev/null
+++ b/sysutils/e2fsprogs/files/patch-SIGINFO-e2fck_unix.c
@@ -0,0 +1,54 @@
+--- e2fsprogs-1.35/e2fsck/unix.c~ Sun Dec 7 18:11:38 2003
++++ e2fsprogs-1.35/e2fsck/unix.c Tue Feb 24 22:13:52 2004
+@@ -416,6 +416,24 @@
+ return 0;
+ }
+
++static int e2fsck_progress_once(e2fsck_t ctx, int pass, unsigned long cur, unsigned long max)
++{
++ char buf[80];
++ float percent;
++
++ if (pass == 0)
++ return 0;
++
++ percent = calc_percent(&e2fsck_tbl, pass, cur, max);
++ e2fsck_simple_progress(ctx, ctx->device_name,
++ percent, 0);
++
++ printf("\n");
++ ctx->progress = 0;
++ return 0;
++}
++
++
+ #define PATH_SET "PATH=/sbin"
+
+ static void reserve_stdio_fds(void)
+@@ -448,6 +466,17 @@
+ ctx->progress_fd = 0;
+ }
+
++static void signal_progress_now(int sig EXT2FS_ATTR((unused)))
++{
++ e2fsck_t ctx = e2fsck_global_ctx;
++
++ if (!ctx)
++ return;
++
++ ctx->progress = e2fsck_progress_once;
++ ctx->progress_fd = 0;
++}
++
+ static void signal_progress_off(int sig EXT2FS_ATTR((unused)))
+ {
+ e2fsck_t ctx = e2fsck_global_ctx;
+@@ -740,6 +769,8 @@
+ sigaction(SIGUSR1, &sa, 0);
+ sa.sa_handler = signal_progress_off;
+ sigaction(SIGUSR2, &sa, 0);
++ sa.sa_handler = signal_progress_now;
++ sigaction(SIGINFO, &sa, 0);
+ #endif
+
+ /* Update our PATH to include /sbin if we need to run badblocks */