mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-01 00:38:31 +00:00
Fix warnings
This change fixes Cosmopolitan so it has fewer opinions about compiler warnings. The whole repository had to be cleaned up to be buildable in -Werror -Wall mode. This lets us benefit from things like strict const checking. Some actual bugs might have been caught too.
This commit is contained in:
parent
e2b3c3618e
commit
0d748ad58e
571 changed files with 1306 additions and 1888 deletions
26
third_party/make/job.c
vendored
26
third_party/make/job.c
vendored
|
@ -410,18 +410,18 @@ get_target_variable (const char *name,
|
|||
return dflt;
|
||||
}
|
||||
|
||||
const char *
|
||||
char *
|
||||
get_tmpdir (struct file *file)
|
||||
{
|
||||
return get_target_variable (STRING_SIZE_TUPLE ("TMPDIR"), file, 0);
|
||||
return strdup (get_target_variable (STRING_SIZE_TUPLE ("TMPDIR"), file, 0));
|
||||
}
|
||||
|
||||
char *
|
||||
new_tmpdir (const char *tmp, struct file *file)
|
||||
{
|
||||
char *tmpdir;
|
||||
const char *s;
|
||||
int c, e, i, j;
|
||||
char *dir, *tmpdir;
|
||||
char cwd[PATH_MAX];
|
||||
char path[PATH_MAX];
|
||||
|
||||
|
@ -1875,9 +1875,9 @@ child_execute_job (struct childbase *child,
|
|||
char outpathbuf[PATH_MAX];
|
||||
int fdout = FD_STDOUT;
|
||||
int fderr = FD_STDERR;
|
||||
const char *s;
|
||||
pid_t pid;
|
||||
int e, r;
|
||||
char *s;
|
||||
|
||||
/* Divert child output if we want to capture it. */
|
||||
if (child->output.syncout)
|
||||
|
@ -1931,11 +1931,11 @@ child_execute_job (struct childbase *child,
|
|||
|
||||
if (sandboxed)
|
||||
{
|
||||
promises = emptytonull (get_target_variable
|
||||
(STRING_SIZE_TUPLE (".PLEDGE"),
|
||||
c ? c->file : 0, 0));
|
||||
if (promises)
|
||||
promises = xstrdup (promises);
|
||||
const char *ps;
|
||||
ps = emptytonull (get_target_variable
|
||||
(STRING_SIZE_TUPLE (".PLEDGE"),
|
||||
c ? c->file : 0, 0));
|
||||
promises = ps ? xstrdup (promises) : 0;
|
||||
if (ParsePromises (promises, &ipromises))
|
||||
{
|
||||
OSS (error, NILF, "%s: invalid .PLEDGE string: %s",
|
||||
|
@ -2128,7 +2128,7 @@ child_execute_job (struct childbase *child,
|
|||
DB (DB_JOBS, (_("Blocked Internet access with seccomp ptrace\n")));
|
||||
else
|
||||
{
|
||||
if (errno = EPERM)
|
||||
if (errno == EPERM)
|
||||
{
|
||||
errno = e;
|
||||
DB (DB_JOBS, (_("Can't block Internet if already traced\n")));
|
||||
|
@ -2152,7 +2152,7 @@ child_execute_job (struct childbase *child,
|
|||
if (!strict || !sandboxed)
|
||||
{
|
||||
if ((s = commandv (argv[0], pathbuf, sizeof (pathbuf))))
|
||||
argv[0] = s;
|
||||
argv[0] = (char *)s;
|
||||
else
|
||||
{
|
||||
OSS (error, NILF, "%s: command not found on $PATH: %s",
|
||||
|
@ -2255,7 +2255,7 @@ child_execute_job (struct childbase *child,
|
|||
if (!c->file->phony &&
|
||||
strlen(c->file->name) < PATH_MAX)
|
||||
{
|
||||
int fd, rc, err;
|
||||
int fd, err;
|
||||
if (c->file->last_mtime == NONEXISTENT_MTIME)
|
||||
{
|
||||
strcpy (outpathbuf, c->file->name);
|
||||
|
@ -2306,7 +2306,7 @@ child_execute_job (struct childbase *child,
|
|||
RETURN_ON_ERROR (Unveil (d->file->name, "rx"));
|
||||
if (n > 4 && READ32LE(d->file->name + n - 4) == READ32LE(".com"))
|
||||
{
|
||||
s = xstrcat (d->file->name, ".dbg");
|
||||
char *s = xstrcat (d->file->name, ".dbg");
|
||||
RETURN_ON_ERROR (Unveil (s, "rx"));
|
||||
free (s);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue