gzipfs.c (82852) | gzipfs.c (83610) |
---|---|
1/* 2 * Copyright (c) 1998 Michael Smith. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/* 2 * Copyright (c) 1998 Michael Smith. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/lib/libstand/gzipfs.c 82852 2001-09-03 05:57:06Z kris $ | 26 * $FreeBSD: head/lib/libstand/gzipfs.c 83610 2001-09-18 13:01:12Z sobomax $ |
27 * 28 */ 29 30#include "stand.h" 31 32#include <sys/stat.h> 33#include <string.h> 34#include <zlib.h> --- 133 unchanged lines hidden (view full) --- 168 char *cp; 169 int error; 170 struct stat sb; 171 172 /* Have to be in "just read it" mode */ 173 if (f->f_flags != F_READ) 174 return(EPERM); 175 | 27 * 28 */ 29 30#include "stand.h" 31 32#include <sys/stat.h> 33#include <string.h> 34#include <zlib.h> --- 133 unchanged lines hidden (view full) --- 168 char *cp; 169 int error; 170 struct stat sb; 171 172 /* Have to be in "just read it" mode */ 173 if (f->f_flags != F_READ) 174 return(EPERM); 175 |
176 /* If the name already ends in .gz, ignore it */ 177 if ((cp = strrchr(fname, '.')) && !strcmp(cp, ".gz")) | 176 /* If the name already ends in .gz or .bz2, ignore it */ 177 if ((cp = strrchr(fname, '.')) && (!strcmp(cp, ".gz") 178 || !strcmp(cp, ".bz2"))) |
178 return(ENOENT); 179 180 /* Construct new name */ 181 zfname = malloc(strlen(fname) + 4); 182 if (zfname == NULL) 183 return(ENOMEM); 184 sprintf(zfname, "%s.gz", fname); 185 --- 138 unchanged lines hidden --- | 179 return(ENOENT); 180 181 /* Construct new name */ 182 zfname = malloc(strlen(fname) + 4); 183 if (zfname == NULL) 184 return(ENOMEM); 185 sprintf(zfname, "%s.gz", fname); 186 --- 138 unchanged lines hidden --- |