Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more warnings #13

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,6 @@ seek_set.o: compile seek.h seek_set.c
select.h: choose compile select.h1 select.h2 trysysel.c
./choose c trysysel select.h1 select.h2 > select.h

sgetopt.o: buffer.h compile sgetopt.c sgetopt.h subgetopt.h
./compile sgetopt.c

sig.o: compile sig.c sig.h
./compile sig.c

Expand Down Expand Up @@ -368,9 +365,6 @@ strerr_die.o: buffer.h compile strerr.h strerr_die.c
strerr_sys.o: compile error.h strerr.h strerr_sys.c
./compile strerr_sys.c

subgetopt.o: compile subgetopt.c subgetopt.h
./compile subgetopt.c

sysdeps: compile direntry.h hasflock.h hasmkffo.h hassgact.h \
hassgprm.h hasshsgr.h haswaitp.h iopause.h load select.h systype \
uint64.h reboot_system.h uw_tmp.h socket.lib
Expand Down Expand Up @@ -444,20 +438,20 @@ buffer_get.o buffer_put.o buffer_read.o buffer_write.o coe.o env.o \
error.o error_str.o fd_copy.o fd_move.o fifo.o lock_ex.o lock_exnb.o \
makelib ndelay_off.o ndelay_on.o open_append.o open_read.o \
open_trunc.o open_write.o openreadclose.o pathexec_env.o \
pathexec_run.o prot.o readclose.o seek_set.o sgetopt.o sig.o \
pathexec_run.o prot.o readclose.o seek_set.o sig.o \
sig_block.o sig_catch.o sig_pause.o stralloc_cat.o stralloc_catb.o \
stralloc_cats.o stralloc_eady.o stralloc_opyb.o stralloc_opys.o \
stralloc_pend.o strerr_die.o strerr_sys.o subgetopt.o wait_nohang.o \
stralloc_pend.o strerr_die.o strerr_sys.o wait_nohang.o \
wait_pid.o
./makelib unix.a alloc.o alloc_re.o buffer.o buffer_0.o buffer_1.o \
buffer_2.o buffer_get.o buffer_put.o buffer_read.o buffer_write.o \
coe.o env.o error.o error_str.o fd_copy.o fd_move.o fifo.o lock_ex.o \
lock_exnb.o ndelay_off.o ndelay_on.o open_append.o open_read.o \
open_trunc.o open_write.o openreadclose.o pathexec_env.o \
pathexec_run.o prot.o readclose.o seek_set.o sgetopt.o sig.o \
pathexec_run.o prot.o readclose.o seek_set.o sig.o \
sig_block.o sig_catch.o sig_pause.o stralloc_cat.o stralloc_catb.o \
stralloc_cats.o stralloc_eady.o stralloc_opyb.o stralloc_opys.o \
stralloc_pend.o strerr_die.o strerr_sys.o subgetopt.o wait_nohang.o \
stralloc_pend.o strerr_die.o strerr_sys.o wait_nohang.o \
wait_pid.o

wait_nohang.o: compile haswaitp.h wait_nohang.c
Expand Down
2 changes: 0 additions & 2 deletions src/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ readclose.o
scan_ulong.o
seek_set.o
select.h
sgetopt.o
sig.o
sig_block.o
sig_catch.o
Expand All @@ -108,7 +107,6 @@ stralloc_opys.o
stralloc_pend.o
strerr_die.o
strerr_sys.o
subgetopt.o
sysdeps
systype
tai_now.o
Expand Down
31 changes: 15 additions & 16 deletions src/chpst.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include "sgetopt.h"
#include "error.h"
#include "strerr.h"
#include "str.h"
Expand Down Expand Up @@ -40,7 +39,7 @@ void usage() { strerr_die4x(100, "usage: ", progname, USAGE_MAIN, "\n"); }

char *set_user =0;
char *env_user =0;
const char *argv0 =0;
char *argv0 =0;
const char *env_dir =0;
unsigned int verbose =0;
unsigned int pgrp =0;
Expand Down Expand Up @@ -258,14 +257,14 @@ void slimit() {
}

/* argv[0] */
void setuidgid(int, const char *const *);
void envuidgid(int, const char *const *);
void setuidgid(int, char **);
void envuidgid(int, char **);
void envdir(int, const char *const *);
void pgrphack(int, const char *const *);
void setlock(int, const char *const *);
void softlimit(int, const char *const *);

int main(int argc, const char **argv) {
int main(int argc, char **argv) {
int opt;
int i;
unsigned long ul;
Expand All @@ -287,10 +286,10 @@ int main(int argc, const char **argv) {
if (str_equal(progname, "softlimit")) softlimit(argc, argv);

while ((opt =getopt(argc, argv, "u:U:b:e:m:d:o:p:f:c:r:t:/:n:l:L:vP012V"))
!= opteof)
!= -1)
switch(opt) {
case 'u': set_user =(char*)optarg; break;
case 'U': env_user =(char*)optarg; break;
case 'u': set_user =optarg; break;
case 'U': env_user =optarg; break;
case 'b': argv0 =(char*)optarg; break;
case 'e': env_dir =optarg; break;
case 'm':
Expand Down Expand Up @@ -367,25 +366,25 @@ int main(int argc, const char **argv) {
void setuidgid_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_SETUIDGID, "\n");
}
void setuidgid(int argc, const char *const *argv) {
const char *account;
void setuidgid(int argc, char **argv) {
char *account;

if (! (account =*++argv)) setuidgid_usage();
if (! *++argv) setuidgid_usage();
suidgid((char*)account, 0);
suidgid(account, 0);
pathexec(argv);
fatal2("unable to run", *argv);
}

void envuidgid_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_ENVUIDGID, "\n");
}
void envuidgid(int argc, const char *const *argv) {
const char *account;
void envuidgid(int argc, char **argv) {
char *account;

if (! (account =*++argv)) envuidgid_usage();
if (! *++argv) envuidgid_usage();
euidgid((char*)account, 0);
euidgid(account, 0);
pathexec(argv);
fatal2("unable to run", *argv);
}
Expand Down Expand Up @@ -422,7 +421,7 @@ void setlock(int argc, const char *const *argv) {
unsigned int x =0;
const char *fn;

while ((opt =getopt(argc, argv, "nNxX")) != opteof)
while ((opt =getopt(argc, argv, "nNxX")) != -1)
switch(opt) {
case 'n': delay =1; break;
case 'N': delay =0; break;
Expand Down Expand Up @@ -453,7 +452,7 @@ void getlarg(long *l) {
void softlimit(int argc, const char *const *argv) {
int opt;

while ((opt =getopt(argc,argv,"a:c:d:f:l:m:o:p:r:s:t:")) != opteof)
while ((opt =getopt(argc,argv,"a:c:d:f:l:m:o:p:r:s:t:")) != -1)
switch(opt) {
case '?': softlimit_usage();
case 'a': getlarg(&limita); break;
Expand Down
26 changes: 13 additions & 13 deletions src/runsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ char *dir;

void usage () { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); }

void fatal(char *m) {
void fatal(const char *m) {
strerr_die5sys(111, "runsv ", dir, ": fatal: ", m, ": ");
}
void fatal2(char *m1, char *m2) {
void fatal2(const char *m1, const char *m2) {
strerr_die6sys(111, "runsv ", dir, ": fatal: ", m1, m2, ": ");
}
void fatalx(char *m1, char *m2) {
void fatalx(const char *m1, const char *m2) {
strerr_die5x(111, "runsv ", dir, ": fatal: ", m1, m2);
}
void warn(char *m) {
void warn(const char *m) {
strerr_warn5("runsv ", dir, ": warning: ", m, ": ", &strerr_sys);
}
void warn2(char *m1, char *m2) {
void warn2(const char *m1, const char *m2) {
strerr_warn6("runsv ", dir, ": warning: ", m1, m2, ": ", &strerr_sys);
}
void warnx(char *m1, char *m2, char *m3) {
void warnx(const char *m1, const char *m2, const char *m3) {
strerr_warn6("runsv ", dir, ": warning: ", m1, m2, m3, 0);
}

Expand All @@ -96,12 +96,12 @@ void update_status(struct svdir *s) {
char bspace[64];
buffer b;
char spid[FMT_ULONG];
char *fstatus ="supervise/status";
char *fstatusnew ="supervise/status.new";
char *fstat ="supervise/stat";
char *fstatnew ="supervise/stat.new";
char *fpid ="supervise/pid";
char *fpidnew ="supervise/pid.new";
const char *fstatus ="supervise/status";
const char *fstatusnew ="supervise/status.new";
const char *fstat ="supervise/stat";
const char *fstatnew ="supervise/stat.new";
const char *fpid ="supervise/pid";
const char *fpidnew ="supervise/pid.new";

if (s->islog) {
fstatus ="log/supervise/status";
Expand Down Expand Up @@ -261,7 +261,7 @@ void stopservice(struct svdir *s) {

void startservice(struct svdir *s) {
int p;
char *run[4];
const char *run[4];
char code[FMT_ULONG];
char stat[FMT_ULONG];

Expand Down
6 changes: 3 additions & 3 deletions src/runsvchdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ char *new;

void usage () { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); }

void fatal(char *m1, char *m2) {
void fatal(const char *m1, const char *m2) {
strerr_die5sys(111, progname, ": fatal: ", m1, m2, ": ");
}
void fatalx(char *m1, char *m2) {
void fatalx(const char *m1, const char *m2) {
strerr_die4x(111, progname, ": fatal: ", m1, m2);
}
void warn(char *m1, char *m2) {
void warn(const char *m1, const char *m2) {
strerr_warn5(progname, ": fatal: ", m1, m2, ": ", &strerr_sys);
}

Expand Down
6 changes: 3 additions & 3 deletions src/runsvdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ int exitsoon =0;
int pgrp =0;

void usage () { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); }
void fatal(char *m1, char *m2) {
void fatal(const char *m1, const char *m2) {
strerr_die6sys(100, "runsvdir ", svdir, ": fatal: ", m1, m2, ": ");
}
void warn(char *m1, char *m2) {
void warn(const char *m1, const char *m2) {
strerr_warn6("runsvdir ", svdir, ": warning: ", m1, m2, ": ", &strerr_sys);
}
void warn3x(char *m1, char *m2, char *m3) {
void warn3x(const char *m1, const char *m2, const char *m3) {
strerr_warn6("runsvdir ", svdir, ": warning: ", m1, m2, m3, 0);
}
void s_term() { exitsoon =1; }
Expand Down
3 changes: 1 addition & 2 deletions src/runsvstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <unistd.h>
#include "strerr.h"
#include "error.h"
#include "sgetopt.h"
#include "open.h"
#include "buffer.h"
#include "tai.h"
Expand Down Expand Up @@ -112,7 +111,7 @@ int main(int argc, char **argv) {

progname =*argv;

while ((opt =getopt(argc, (const char * const *)argv, "lV")) != opteof) {
while ((opt =getopt(argc, (const char * const *)argv, "lV")) != -1) {
switch(opt) {
case 'l':
showlog =1;
Expand Down
53 changes: 0 additions & 53 deletions src/sgetopt.c

This file was deleted.

23 changes: 0 additions & 23 deletions src/sgetopt.h

This file was deleted.

Loading