Merge branch 'aspiers-fix-compile-warnings'

This commit is contained in:
Timothy Stack 2016-12-17 21:14:00 -08:00
commit 854c79108e
9 changed files with 54 additions and 30 deletions

View File

@ -2449,7 +2449,9 @@ int main(int argc, char *argv[])
case 'W':
{
char b;
read(STDIN_FILENO, &b, 1);
if (read(STDIN_FILENO, &b, 1) == -1) {
perror("Read key from STDIN");
}
}
break;
@ -2496,7 +2498,17 @@ int main(int argc, char *argv[])
snprintf(pull_cmd, sizeof(pull_cmd),
"cd %s && git pull",
git_dir);
system(pull_cmd);
int ret = system(pull_cmd);
if (ret == -1) {
std::cerr << "Failed to spawn command "
<< "\"" << pull_cmd << "\": "
<< strerror(errno) << std::endl;
}
else if (ret > 0) {
std::cerr << "Command "
<< "\"" << pull_cmd << "\" failed: "
<< strerror(errno) << std::endl;
}
found = true;
}
}
@ -3000,8 +3012,11 @@ int main(int argc, char *argv[])
++vl, ++y) {
while (los != NULL &&
los->list_value_for_overlay(*tc, y, al)) {
write(STDOUT_FILENO, line.c_str(), line.length());
write(STDOUT_FILENO, "\n", 1);
if (write(STDOUT_FILENO, line.c_str(),
line.length()) == -1 ||
write(STDOUT_FILENO, "\n", 1) == -1) {
perror("write to STDOUT");
}
++y;
}
@ -3012,9 +3027,11 @@ int main(int argc, char *argv[])
struct line_range lr = find_string_attr_range(
al.get_attrs(), &textview_curses::SA_ORIGINAL_LINE);
write(STDOUT_FILENO, lr.substr(al.get_string()),
lr.sublen(al.get_string()));
write(STDOUT_FILENO, "\n", 1);
if (write(STDOUT_FILENO, lr.substr(al.get_string()),
lr.sublen(al.get_string())) == -1 ||
write(STDOUT_FILENO, "\n", 1) == -1) {
perror("write to STDOUT");
}
}
}
}
@ -3070,8 +3087,10 @@ int main(int argc, char *argv[])
++line_iter) {
lf->read_line(line_iter, str);
write(STDOUT_FILENO, str.c_str(), str.size());
write(STDOUT_FILENO, "\n", 1);
if (write(STDOUT_FILENO, str.c_str(), str.size()) == -1 ||
write(STDOUT_FILENO, "\n", 1) == -1) {
perror("write to STDOUT");
}
}
}
}

View File

@ -64,7 +64,7 @@ static string remaining_args(const string &cmdline,
require(index > 0);
for (int lpc = 0; lpc < index; lpc++) {
for (size_t lpc = 0; lpc < index; lpc++) {
start_pos += args[lpc].length();
}
@ -571,7 +571,7 @@ static string com_save_to(exec_context &ec, string cmdline, vector<string> &args
dos.list_value_for_overlay(lnav_data.ld_views[LNV_DB], vis_line_t(0), header_line);
fputs(header_line.get_string().c_str(), outfile);
fputc('\n', outfile);
for (int lpc = 0; lpc < dls.text_line_count(); lpc++) {
for (size_t lpc = 0; lpc < dls.text_line_count(); lpc++) {
string line;
dls.text_value_for_line(lnav_data.ld_views[LNV_DB], lpc, line, true);

View File

@ -182,8 +182,12 @@ void log_host_info(void)
log_info(" gid=%d", getgid());
log_info(" euid=%d", geteuid());
log_info(" egid=%d", getegid());
getcwd(cwd, sizeof(cwd));
log_info(" cwd=%s", cwd);
if (getcwd(cwd, sizeof(cwd)) == NULL) {
log_info(" ERROR: getcwd failed");
}
else {
log_info(" cwd=%s", cwd);
}
log_info("Executable:");
log_info(" version=%s", VCS_PACKAGE_STRING);

View File

@ -319,7 +319,7 @@ static time_t BAD_DATE = -1;
time_t tm2sec(const struct tm *t)
{
int year;
time_t days;
time_t days, secs;
const int dayoffset[12] =
{ 306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275 };
@ -341,18 +341,18 @@ time_t tm2sec(const struct tm *t)
days += dayoffset[t->tm_mon] + t->tm_mday - 1;
days -= 25508; /* 1 jan 1970 is 25508 days since 1 mar 1900 */
days = ((days * 24 + t->tm_hour) * 60 + t->tm_min) * 60 + t->tm_sec;
secs = ((days * 24 + t->tm_hour) * 60 + t->tm_min) * 60 + t->tm_sec;
if (days < 0) {
if (secs < 0) {
return BAD_DATE;
} /* must have overflowed */
else {
#ifdef HAVE_STRUCT_TM_TM_ZONE
if (t->tm_zone) {
days -= t->tm_gmtoff;
secs -= t->tm_gmtoff;
}
#endif
return days;
return secs;
} /* must be a valid time */
}

View File

@ -102,9 +102,9 @@ public:
this->ptp_search.c_str(),
this->ptp_search.size());
asprintf(this->ptp_token_header.out(),
"X-Papertrail-Token: %s",
this->ptp_api_key);
log_perror(asprintf(this->ptp_token_header.out(),
"X-Papertrail-Token: %s",
this->ptp_api_key));
this->ptp_header_list = curl_slist_append(this->ptp_header_list,
this->ptp_token_header.in());
@ -140,10 +140,10 @@ public:
"max_time=%ld&",
this->ptp_max_time);
}
asprintf(this->ptp_url.out(),
"%sq=%s",
base_url,
this->ptp_quoted_search.in());
log_perror(asprintf(this->ptp_url.out(),
"%sq=%s",
base_url,
this->ptp_quoted_search.in()));
curl_easy_setopt(this->cr_handle, CURLOPT_URL, this->ptp_url.in());
};

View File

@ -38,6 +38,7 @@
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <inttypes.h>
#include <sys/types.h>
#include <arpa/inet.h>
@ -381,10 +382,10 @@ inline bool ptime_i(struct exttm *dst, const char *str, off_t &off_inout, ssize_
inline void ftime_i(char *dst, off_t &off_inout, ssize_t len, const struct exttm &tm)
{
uint64_t t = tm2sec(&tm.et_tm);
int64_t t = tm2sec(&tm.et_tm);
t += tm.et_nsec / 1000000;
snprintf(&dst[off_inout], len - off_inout, "%lld", t);
snprintf(&dst[off_inout], len - off_inout, "%" PRId64, t);
off_inout = strlen(dst);
}

View File

@ -219,7 +219,7 @@ bool relative_time::parse(const char *str, size_t len, struct parse_error &pe_ou
string numstr = pi.get_substr(pc[0]);
if (sscanf(numstr.c_str(), "%qd", &number) != 1) {
if (sscanf(numstr.c_str(), "%" PRId64, &number) != 1) {
pe_out.pe_msg = "Invalid number: " + numstr;
return false;
}

View File

@ -76,7 +76,8 @@ public:
default:
log_error("%s:curl failure -- %ld %s",
this->cr_name.c_str(), result, curl_easy_strerror(result));
write(this->ul_fd, this->cr_error_buffer, strlen(this->cr_error_buffer));
log_perror(write(this->ul_fd, this->cr_error_buffer,
strlen(this->cr_error_buffer)));
return -1;
}

View File

@ -100,7 +100,6 @@ Caused by: java.lang.ClassNotFoundException: javax.el.StaticFieldELResolver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
... 33 common frames omitted
@version: 1
logger_name: org.apache.jasper.runtime.JspFactoryImpl
thread_name: http-bio-0.0.0.0-8081-exec-198