pl.c (96388) | pl.c (96392) |
---|---|
1/* 2 * FreeBSD install - a package for the installation and maintainance 3 * of non-core utilities. 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 --- 5 unchanged lines hidden (view full) --- 14 * Jordan K. Hubbard 15 * 18 July 1993 16 * 17 * Routines for dealing with the packing list. 18 * 19 */ 20 21#include <sys/cdefs.h> | 1/* 2 * FreeBSD install - a package for the installation and maintainance 3 * of non-core utilities. 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 --- 5 unchanged lines hidden (view full) --- 14 * Jordan K. Hubbard 15 * 18 July 1993 16 * 17 * Routines for dealing with the packing list. 18 * 19 */ 20 21#include <sys/cdefs.h> |
22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/create/pl.c 96388 2002-05-11 03:48:49Z alfred $"); | 22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/create/pl.c 96392 2002-05-11 04:17:55Z alfred $"); |
23 24#include "lib.h" 25#include "create.h" 26#include <errno.h> 27#include <err.h> 28#include <md5.h> 29 30/* Check a list for files that require preconversion */ --- 66 unchanged lines hidden (view full) --- 97 98#define STARTSTRING "tar cf -" 99#define TOOBIG(str) (int)strlen(str) + 6 + (int)strlen(home) + where_count > maxargs 100#define PUSHOUT() /* push out string */ \ 101 if (where_count > (int)sizeof(STARTSTRING)-1) { \ 102 strcat(where_args, "|tar xpf -"); \ 103 if (system(where_args)) { \ 104 cleanup(0); \ | 23 24#include "lib.h" 25#include "create.h" 26#include <errno.h> 27#include <err.h> 28#include <md5.h> 29 30/* Check a list for files that require preconversion */ --- 66 unchanged lines hidden (view full) --- 97 98#define STARTSTRING "tar cf -" 99#define TOOBIG(str) (int)strlen(str) + 6 + (int)strlen(home) + where_count > maxargs 100#define PUSHOUT() /* push out string */ \ 101 if (where_count > (int)sizeof(STARTSTRING)-1) { \ 102 strcat(where_args, "|tar xpf -"); \ 103 if (system(where_args)) { \ 104 cleanup(0); \ |
105 errx(2, "%s: can't invoke tar pipeline", __FUNCTION__); \ | 105 errx(2, "%s: can't invoke tar pipeline", __func__); \ |
106 } \ 107 memset(where_args, 0, maxargs); \ 108 last_chdir = NULL; \ 109 strcpy(where_args, STARTSTRING); \ 110 where_count = sizeof(STARTSTRING)-1; \ 111 } 112 113/* --- 15 unchanged lines hidden (view full) --- 129 maxargs = sysconf(_SC_ARG_MAX); 130 maxargs -= 64; /* 131 * Some slop for the tar cmd text, 132 * and sh -c 133 */ 134 where_args = malloc(maxargs); 135 if (!where_args) { 136 cleanup(0); | 106 } \ 107 memset(where_args, 0, maxargs); \ 108 last_chdir = NULL; \ 109 strcpy(where_args, STARTSTRING); \ 110 where_count = sizeof(STARTSTRING)-1; \ 111 } 112 113/* --- 15 unchanged lines hidden (view full) --- 129 maxargs = sysconf(_SC_ARG_MAX); 130 maxargs -= 64; /* 131 * Some slop for the tar cmd text, 132 * and sh -c 133 */ 134 where_args = malloc(maxargs); 135 if (!where_args) { 136 cleanup(0); |
137 errx(2, "%s: can't get argument list space", __FUNCTION__); | 137 errx(2, "%s: can't get argument list space", __func__); |
138 } 139 140 memset(where_args, 0, maxargs); 141 strcpy(where_args, STARTSTRING); 142 where_count = sizeof(STARTSTRING)-1; 143 last_chdir = 0; 144 145 if (stat(".", &stb) == 0) --- 52 unchanged lines hidden (view full) --- 198 " %s%s %s", 199 last_chdir == home ? "" : "-C ", 200 last_chdir == home ? "" : home, 201 p->name); 202 last_chdir = home; 203 } 204 if (add_count < 0 || add_count > maxargs - where_count) { 205 cleanup(0); | 138 } 139 140 memset(where_args, 0, maxargs); 141 strcpy(where_args, STARTSTRING); 142 where_count = sizeof(STARTSTRING)-1; 143 last_chdir = 0; 144 145 if (stat(".", &stb) == 0) --- 52 unchanged lines hidden (view full) --- 198 " %s%s %s", 199 last_chdir == home ? "" : "-C ", 200 last_chdir == home ? "" : home, 201 p->name); 202 last_chdir = home; 203 } 204 if (add_count < 0 || add_count > maxargs - where_count) { 205 cleanup(0); |
206 errx(2, "%s: oops, miscounted strings!", __FUNCTION__); | 206 errx(2, "%s: oops, miscounted strings!", __func__); |
207 } 208 where_count += add_count; 209 } 210 /* 211 * Otherwise, try along the actual extraction path.. 212 */ 213 else { 214 if (p->name[0] == '/') --- 21 unchanged lines hidden (view full) --- 236 else 237 add_count = snprintf(&where_args[where_count], 238 maxargs - where_count, 239 " -C %s %s", 240 mythere ? mythere : where, 241 p->name); 242 if (add_count < 0 || add_count > maxargs - where_count) { 243 cleanup(0); | 207 } 208 where_count += add_count; 209 } 210 /* 211 * Otherwise, try along the actual extraction path.. 212 */ 213 else { 214 if (p->name[0] == '/') --- 21 unchanged lines hidden (view full) --- 236 else 237 add_count = snprintf(&where_args[where_count], 238 maxargs - where_count, 239 " -C %s %s", 240 mythere ? mythere : where, 241 p->name); 242 if (add_count < 0 || add_count > maxargs - where_count) { 243 cleanup(0); |
244 errx(2, "%s: oops, miscounted strings!", __FUNCTION__); | 244 errx(2, "%s: oops, miscounted strings!", __func__); |
245 } 246 where_count += add_count; 247 last_chdir = (mythere ? mythere : where); 248 } 249 } 250 p = p->next; 251 } 252 PUSHOUT(); 253 free(where_args); 254} | 245 } 246 where_count += add_count; 247 last_chdir = (mythere ? mythere : where); 248 } 249 } 250 p = p->next; 251 } 252 PUSHOUT(); 253 free(where_args); 254} |