Skip to content

Commit

Permalink
- Use PATH_MAX where appropriate
Browse files Browse the repository at this point in the history
- Strip directory names in prompt
  • Loading branch information
megastep committed Jan 25, 2005
1 parent 360ddd9 commit b011611
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ static ssize_t copy_list(install_info *info, const char *filedesc, const char *d
xmlNodePtr node,
UIUpdateFunc update)
{
char fpat[BUFSIZ];
char fpat[PATH_MAX];
int i;
glob_t globbed;
ssize_t size, copied;
Expand Down Expand Up @@ -1093,7 +1093,7 @@ ssize_t copy_tree(install_info *info, xmlNodePtr node, const char *dest,
ssize_t size_manpage(install_info *info, xmlNodePtr node, const char *from_cdrom)
{
struct stat sb;
char fpat[BUFSIZ];
char fpat[PATH_MAX];
char *section = xmlGetProp(node, "section"), *name = xmlGetProp(node, "name");
ssize_t size = 0;

Expand Down Expand Up @@ -1123,7 +1123,7 @@ ssize_t size_manpage(install_info *info, xmlNodePtr node, const char *from_cdrom
ssize_t size_binary(install_info *info, const char *from_cdrom, const char *filedesc)
{
struct stat sb;
char fpat[BUFSIZ], final[BUFSIZ];
char fpat[PATH_MAX], final[PATH_MAX];
ssize_t size;

size = 0;
Expand Down
2 changes: 1 addition & 1 deletion file.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ stream *file_open_install(install_info *info, const char *path, const char *mode

if ( prompt_overwrite ) {
char msg[128];
snprintf(msg, sizeof(msg), _("File '%25s' already exists, overwrite?"), path);
snprintf(msg, sizeof(msg), _("File '%25s' already exists, overwrite?"), loki_basename(path));
if ( UI.prompt(msg, RESPONSE_YES) != RESPONSE_YES ) {
return NULL;
}
Expand Down
6 changes: 3 additions & 3 deletions install.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: install.c,v 1.149 2004-12-12 22:39:37 megastep Exp $ */
/* $Id: install.c,v 1.150 2005-01-25 03:00:57 megastep Exp $ */

/* Modifications by Borland/Inprise Corp.:
04/10/2000: Added code to expand ~ in a default path immediately after
Expand Down Expand Up @@ -508,7 +508,7 @@ const char *GetProductEULANode(install_info *info, xmlNodePtr node, int *keepdir

eula = xmlGetProp(node, "eula");
if (eula) {
strncpy(matched_name, eula, BUFSIZ);
strncpy(matched_name, eula, sizeof(matched_name));
found = 1;
log_warning("The 'eula' attribute is deprecated, please use the 'eula' element from now on.");
xmlFree(eula);
Expand Down Expand Up @@ -559,7 +559,7 @@ const char *GetProductREADME(install_info *info, int *keepdirs)
if ( ! ret ) {
strcpy(matched_name, "README");
} else {
strncpy(matched_name, ret, BUFSIZ);
strncpy(matched_name, ret, sizeof(matched_name));
found = 1;
log_warning("The 'readme' attribute is deprecated, please use the 'readme' element from now on.");
xmlFree(ret);
Expand Down
2 changes: 1 addition & 1 deletion plugins/cpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ size_t copy_cpio_stream(install_info *info, stream *input, const char *dest, con
int dir_len = strlen(dest) + 1;
size_t nread, left, copied;
size_t size = 0;
char buf[BUFSIZ];
char buf[PATH_MAX];
int count = 0;
unsigned int user_mode = 0;
/* Optional MD5 sum can be specified in the XML file */
Expand Down
4 changes: 2 additions & 2 deletions plugins/tar.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* TAR plugin for setup */
/* $Id: tar.c,v 1.12 2004-11-02 03:48:57 megastep Exp $ */
/* $Id: tar.c,v 1.13 2005-01-25 03:00:57 megastep Exp $ */

#include "config.h"
#include "plugins.h"
Expand Down Expand Up @@ -44,7 +44,7 @@ static size_t TarCopy(install_info *info, const char *path, const char *dest, co
{
static tar_record zeroes;
tar_record record;
char final[BUFSIZ];
char final[PATH_MAX];
stream *input, *output;
size_t size, copied;
size_t this_size;
Expand Down
4 changes: 2 additions & 2 deletions plugins/uz2.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* UnrealEngine2-compressed files (.uz2) plugin for setup */
/* $Id: uz2.c,v 1.6 2004-11-02 03:48:57 megastep Exp $ */
/* $Id: uz2.c,v 1.7 2005-01-25 03:00:57 megastep Exp $ */

#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -103,7 +103,7 @@ static size_t UZ2Copy(install_info *info, const char *path, const char *dest, co
uint32 csize; /* compressed size */
uint32 usize; /* uncompressed size */
size_t insize = 0;
char final[BUFSIZ];
char final[PATH_MAX];
stream *in;
stream *out;
unsigned int user_mode = 0;
Expand Down
6 changes: 3 additions & 3 deletions plugins/zip.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ZIP plugin for setup */
/* $Id: zip.c,v 1.9 2004-11-02 03:48:57 megastep Exp $ */
/* $Id: zip.c,v 1.10 2005-01-25 03:00:57 megastep Exp $ */

#include "plugins.h"
#include "file.h"
Expand Down Expand Up @@ -665,7 +665,7 @@ static size_t ZIPCopy(install_info *info, const char *path, const char *dest, co
xmlNodePtr node,
UIUpdateFunc update)
{
char final[BUFSIZ];
char final[PATH_MAX];
z_stream zstr;
size_t retval = 0;
ZIPinfo zipinfo;
Expand Down Expand Up @@ -850,7 +850,7 @@ static size_t ZIPCopy(install_info *info, const char *path, const char *dest, co

if (symlnk)
{
char lnkname[BUFSIZ];
char lnkname[PATH_MAX];
/* null-terminate string. */
zip_buf_out[entry->uncompressed_size] = '\0';
zip_expand_symlink_path(zip_buf_out);
Expand Down

0 comments on commit b011611

Please sign in to comment.