PERFORCE change 181393 for review
Julien Laffaye
jlaffaye at FreeBSD.org
Fri Jul 23 20:54:45 UTC 2010
http://p4web.freebsd.org/@@181393?ac=10
Change 181393 by jlaffaye at jlaffaye-chulak on 2010/07/23 20:53:46
Read from stdin if filename is '-'.
Affected files ...
.. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/perform.c#5 edit
Differences ...
==== //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/perform.c#5 (text+ko) ====
@@ -64,6 +64,7 @@
struct archive *a = NULL;
struct archive_entry *entry;
const char *pathname;
+ int fd = 0;
int retcode = 0;
a = archive_read_new();
@@ -80,7 +81,16 @@
/* TODO: add support */
return (1);
} else {
- if (archive_read_open_filename(a, fname, 10240) != ARCHIVE_OK) {
+ if (strcmp(fname, "-") == 0)
+ fd = fileno(stdin);
+ else {
+ if ((fd = open(fname, O_RDONLY)) == -1) {
+ warn("open(%s)", fname);
+ return (1);
+ }
+ }
+
+ if (archive_read_open_fd(a, fd, 10240) != ARCHIVE_OK) {
warnx("Can not open '%s' archive: %s", fname,
archive_error_string(a));
retcode = 1;
More information about the p4-projects
mailing list