Skip to content
forked from BOINC/boinc

Commit

Permalink
use MAXPATHLEN and sizeof() a few places; from Gianfranco
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpanderson committed May 22, 2013
1 parent 023e1ce commit 0983315
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion client/cs_platforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void CLIENT_STATE::detect_platforms() {
for (i=0; i < nlibdirs; i++) {
struct dirent *entry;
DIR *a = opendir(libdir[i]);
// if dir doesn't exist, do to the next one
// if dir doesn't exist, do the next one
if (a == 0) continue;
// dir exists. read each entry until you find a 32bit lib
while ((support32 == 0) && ((entry=readdir(a)) != 0)) {
Expand Down
4 changes: 2 additions & 2 deletions client/file_names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int make_soft_link(PROJECT* project, char* link_path, char* rel_file_path) {
//
void get_pathname(FILE_INFO* fip, char* path, int len) {
PROJECT* p = fip->project;
char buf[1024];
char buf[MAXPATHLEN];

// for testing purposes, it's handy to allow a FILE_INFO without
// an associated PROJECT.
Expand Down Expand Up @@ -176,7 +176,7 @@ int remove_project_dir(PROJECT& p) {
// Create the slot directory for the specified slot #
//
int make_slot_dir(int slot) {
char buf[1024];
char buf[MAXPATHLEN];

if (slot<0) {
msg_printf(NULL, MSG_INTERNAL_ERROR, "Bad slot number %d", slot);
Expand Down
18 changes: 9 additions & 9 deletions lib/diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ static _CrtMemState difference_snapshot;

static int diagnostics_initialized = false;
static int flags;
static char stdout_log[256];
static char stdout_archive[256];
static char stdout_log[MAXPATHLEN];
static char stdout_archive[MAXPATHLEN];
static FILE* stdout_file;
static char stderr_log[256];
static char stderr_archive[256];
static char stderr_log[MAXPATHLEN];
static char stderr_archive[MAXPATHLEN];
static FILE* stderr_file;
static char boinc_dir[256];
static char boinc_install_dir[256];
static char boinc_dir[MAXPATHLEN];
static char boinc_install_dir[MAXPATHLEN];
static int boinc_proxy_enabled;
static char boinc_proxy[256];
static char symstore[256];
Expand Down Expand Up @@ -330,13 +330,13 @@ int diagnostics_init(
mf.init_file(p);
while(mf.fgets(buf, sizeof(buf))) {
if (match_tag(buf, "</app_init_data>")) break;
else if (parse_str(buf, "<boinc_dir>", boinc_dir, 256)) continue;
else if (parse_str(buf, "<symstore>", symstore, 256)) continue;
else if (parse_str(buf, "<boinc_dir>", boinc_dir, sizeof(boinc_dir))) continue;
else if (parse_str(buf, "<symstore>", symstore, sizeof(symstore))) ;
else if (match_tag(buf, "<use_http_proxy/>")) {
boinc_proxy_enabled = true;
continue;
}
else if (parse_str(buf, "<http_server_name>", proxy_address, 256)) continue;
else if (parse_str(buf, "<http_server_name>", proxy_address, sizeof(proxy_address))) continue;
else if (parse_int(buf, "<http_server_port>", proxy_port)) continue;
}
fclose(p);
Expand Down
2 changes: 1 addition & 1 deletion lib/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ bool is_localhost(sockaddr_storage& s) {
case AF_INET6: {
sockaddr_in6* sin = (sockaddr_in6*)&s;
char buf[256];
inet_ntop(AF_INET6, (void*)(&sin->sin6_addr), buf, 256);
inet_ntop(AF_INET6, (void*)(&sin->sin6_addr), buf, sizeof(buf));
return (strcmp(buf, "::1") == 0);
break;
}
Expand Down
1 change: 1 addition & 0 deletions lib/procinfo_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

#include "str_util.h"
#include "str_replace.h"
#include "filesys.h"

#include "procinfo.h"

Expand Down
4 changes: 0 additions & 4 deletions stripchart/stripchart.cnf
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#! /usr/bin/env perl

use Time::Local;

# What version is this?
$majorversion = 2; $minorversion = 1;

# Directory where gnuplot is
# $gnuplot = "/usr/local/gnuplot-3.7";
#$gnuplot = "/disks/asimov/a/users/hiramc/local/src/gnuplot-3.7";
$gnuplot = "/usr/local/bin"

# Temporary files
Expand Down

0 comments on commit 0983315

Please sign in to comment.