From: Theodore Ts'o Date: Tue, 16 Mar 1999 19:35:19 +0000 (+0000) Subject: ChangeLog, Makefile.in, fsck.c, mke2fs.c, uuidgen.1.in, uuidgen.c: X-Git-Tag: E2FSPROGS-1_15~41 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=5d45d80375943be8917302a502f3f28d2df8d16d;p=tools%2Fe2fsprogs.git ChangeLog, Makefile.in, fsck.c, mke2fs.c, uuidgen.1.in, uuidgen.c: uuidgen.c, uuidgen.1.in: Created command-line utility to generate UUIDs. fsck.c (fsck_device, execute): Don't dereference a null pointer when checking a filesystem not in /etc/fstab. --- diff --git a/misc/ChangeLog b/misc/ChangeLog index a44e352..1babd22 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,13 @@ +1999-03-11 Andreas Dilger + + * uuidgen.c, uuidgen.1.in: Created command-line utility to + generate UUIDs. + +1999-03-14 Theodore Ts'o + + * fsck.c (fsck_device, execute): Don't dereference a null pointer + when checking a filesystem not in /etc/fstab. + 1999-02-09 Theodore Ts'o * fsck.c (fsck_device): Print an error message if the user passes diff --git a/misc/Makefile.in b/misc/Makefile.in index 83877cf..e140db6 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -16,14 +16,15 @@ USPROGS= mklost+found SMANPAGES= tune2fs.8 mklost+found.8 mke2fs.8 dumpe2fs.8 badblocks.8 \ e2label.8 @FSCK_MAN@ -UPROGS= chattr lsattr -UMANPAGES= chattr.1 lsattr.1 +UPROGS= chattr lsattr uuidgen +UMANPAGES= chattr.1 lsattr.1 uuidgen.1 TUNE2FS_OBJS= tune2fs.o MKLPF_OBJS= mklost+found.o MKE2FS_OBJS= mke2fs.o CHATTR_OBJS= chattr.o LSATTR_OBJS= lsattr.o +UUIDGEN_OBJS= uuidgen.o DUMPE2FS_OBJS= dumpe2fs.o BADBLOCKS_OBJS= badblocks.o E2LABEL_OBJS= e2label.o @@ -31,7 +32,7 @@ FSCK_OBJS= fsck.o SRCS= $(srcdir)/tune2fs.c $(srcdir)/mklost+found.c $(srcdir)/mke2fs.c \ $(srcdir)/chattr.c $(srcdir)/lsattr.c $(srcdir)/dumpe2fs.c \ - $(srcdir)/badblocks.c $(srcdir)/fsck.c + $(srcdir)/badblocks.c $(srcdir)/fsck.c $(srcdir)/uuidgen.c LIBS= $(LIBEXT2FS) $(LIBCOM_ERR) DEPLIBS= $(LIBEXT2FS) $(LIBCOM_ERR) @@ -72,6 +73,9 @@ chattr: $(CHATTR_OBJS) $(DEPLIBS_E2P) lsattr: $(LSATTR_OBJS) $(DEPLIBS_E2P) $(CC) $(ALL_LDFLAGS) -o lsattr $(LSATTR_OBJS) $(LIBS_E2P) +uuidgen: $(UUIDGEN_OBJS) $(LIBUUID) + $(CC) $(ALL_LDFLAGS) -o uuidgen $(UUIDGEN_OBJS) $(LIBUUID) + dumpe2fs: $(DUMPE2FS_OBJS) $(DEPLIBS_E2P) $(CC) $(ALL_LDFLAGS) -o dumpe2fs $(DUMPE2FS_OBJS) $(LIBS_E2P) @@ -108,6 +112,9 @@ chattr.1: $(DEP_SUBSTITUTE) $(srcdir)/chattr.1.in lsattr.1: $(DEP_SUBSTITUTE) $(srcdir)/lsattr.1.in $(SUBSTITUTE) $(srcdir)/lsattr.1.in lsattr.1 +uuidgen.1: $(DEP_SUBSTITUTE) $(srcdir)/uuidgen.1.in + $(SUBSTITUTE) $(srcdir)/uuidgen.1.in uuidgen.1 + installdirs: $(top_srcdir)/mkinstalldirs $(DESTDIR)$(sbindir) \ $(DESTDIR)$(root_sbindir) $(DESTDIR)$(bindir) \ @@ -180,6 +187,8 @@ chattr.o: $(srcdir)/chattr.c $(top_srcdir)/lib/et/com_err.h \ $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/../version.h lsattr.o: $(srcdir)/lsattr.c $(top_srcdir)/lib/et/com_err.h \ $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/../version.h +uuidgen.o: $(srcdir)/uuidgen.c $(top_srcdir)/lib/uuid/uuid.h \ + $(srcdir)/../version.h dumpe2fs.o: $(srcdir)/dumpe2fs.c \ $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ diff --git a/misc/fsck.c b/misc/fsck.c index 678da9a..669e307 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -362,7 +362,7 @@ static int execute(char *prog, char *device, char *mntpt) } if (verbose || noexecute) { - printf("[%s -- %s] ", s, mntpt); + printf("[%s -- %s] ", s, mntpt ? mntpt : device); for (i=0; i < argc; i++) printf("%s ", argv[i]); printf("\n"); @@ -517,7 +517,7 @@ static void fsck_device(char *device) type = DEFAULT_FSTYPE; sprintf(prog, "fsck.%s", type); - retval = execute(prog, device, fsent->mountpt); + retval = execute(prog, device, fsent ? fsent->mountpt : 0); if (retval) { fprintf(stderr, "%s: Error %d while executing %s for %s\n", progname, retval, prog, device); diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 7f5e5e5..9469d16 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -957,8 +957,12 @@ int main (int argc, char *argv[]) if (!quiet) printf("Writing superblocks and " "filesystem accounting information: "); - ext2fs_close(fs); + retval = ext2fs_flush(fs); + if (retval) { + printf("\nWarning, had trouble writing out superblocks."); + } if (!quiet) printf("done\n"); + ext2fs_close(fs); return 0; } diff --git a/misc/uuidgen.1.in b/misc/uuidgen.1.in new file mode 100644 index 0000000..48e8ffc --- /dev/null +++ b/misc/uuidgen.1.in @@ -0,0 +1,37 @@ +.\" Copyright 1999 Andreas Dilger (adilger@enel.ucalgary.ca) +.\" +.\" This man page was created for libuuid.so.1.1 from e2fsprogs-1.14. +.\" +.\" This file may be copied under the terms of the GNU Public License. +.\" +.\" Created Wed Mar 10 17:42:12 1999, Andreas Dilger +.TH UUIDGEN "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" +.SH NAME +uuidgen \- command\-line utility to create a new unique UUID value +.SH SYNOPSIS +.nf +.B uuidgen +.fi +.SH DESCRIPTION +The +.B uuidgen +program creates a new universally unique identifier using the +.BR libuuid "(3) functions " uuid_generate "(3) and " uuid_unparse "(3)." +The new UUID can reasonably be considered unique among all UUIDs created +on the local system, and among UUIDs created on other systems in the past +and in the future. +.SH RETURN VALUE +The UUID of the form 1b4e28ba\-2fa1\-11d2\-883f\-b9a761bde3fb (in +.BR printf (3) +format "%08x\-%04x\-%04x\-%04x\-%012x") is output to the standard output. +.SH "CONFORMING TO" +OSF DCE 1.1 +.SH AUTHOR +.B uuidgen +was written by Andreas Dilger for libuuid. +.SH AVAILABILITY +.B uuidgen +is part of libuuid from the e2fsprogs package and is available for anonymous +ftp from tsx\-11.mit.edu (and its mirrors) in /pub/linux/packages/ext2fs. +.SH "SEE ALSO" +.BR libuuid (3) diff --git a/misc/uuidgen.c b/misc/uuidgen.c new file mode 100644 index 0000000..2b467e9 --- /dev/null +++ b/misc/uuidgen.c @@ -0,0 +1,27 @@ +/* + * gen_uuid.c --- generate a DCE-compatible uuid + * + * Copyright (C) 1999, Andreas Dilger + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Public + * License. + * %End-Header% + */ + +#include +#include "uuid/uuid.h" + +int +main (int argc, char *argv[]) +{ + char str[37]; + uuid_t uu; + + uuid_generate(uu); + uuid_unparse(uu, str); + + printf("%s\n", str); + + return 0; +}