public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [robots - The game; Fight against maniac robots] branch master, updated. f021172a007888eac5bcb6c6e33eedc030f1dece
@ 2023-02-07 11:22 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-02-07 11:22 UTC (permalink / raw)
To: cygwin-apps-cvs
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/robots.git;h=f021172a007888eac5bcb6c6e33eedc030f1dece
commit f021172a007888eac5bcb6c6e33eedc030f1dece
Author: Corinna Vinschen <vinschen@redhat.com>
Date: Tue Feb 7 12:18:05 2023 +0100
improve Makefile
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/robots.git;h=c9891437927399d8a14d54ff9f8cf59b4ebb0c46
commit c9891437927399d8a14d54ff9f8cf59b4ebb0c46
Author: Corinna Vinschen <vinschen@redhat.com>
Date: Tue Feb 7 11:20:39 2023 +0100
fix gcc warnings
Diff:
---
Makefile | 7 +++++--
score.c | 9 +++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 8a9bbf075a85..dda9c3da9d36 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+srcdir = .
+VPATH = $(srcdir)
# just -lcurses for SYS V
#LIBS = -lcurses -ltermcap
LIBS = -lncurses
@@ -7,7 +9,8 @@ LIBS = -lncurses
# -DALLSCORES don't take a user only once per highscore
OPTIONS = -DALLSCORES
CPPFLAGS= -I/usr/include/ncurses
-CFLAGS = $(IFDEF) $(OPTIONS) -DSCOREDIR='"$(scoredir)"' -g -O2 -Wall
+CFLAGS += $(IFDEF) $(OPTIONS) -DSCOREDIR='"$(scoredir)"' -g -O2 -pipe
+CFLAGS += -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4
# Suffix of executables. ".exe" on Windows based systems
EXEEXT = .exe
@@ -42,7 +45,7 @@ install: robots$(EXEEXT) robots.6
-mkdir -p $(DESTDIR)$(mandir)
install -c robots.6 $(DESTDIR)$(mandir)
-mkdir -p $(DESTDIR)$(postinstalldir)
- sed -e 's#@SCOREDIR@#$(scoredir)#' < robots.sh > $(DESTDIR)$(postinstalldir)/robots.sh
+ sed -e 's#@SCOREDIR@#$(scoredir)#' < $(srcdir)/robots.sh > $(DESTDIR)$(postinstalldir)/robots.sh
tidy: clean
clean:
diff --git a/score.c b/score.c
index 0a1b75a76843..3933c9e07131 100644
--- a/score.c
+++ b/score.c
@@ -137,7 +137,7 @@ do_score(bool eaten, int fd, int max_days, char *type_str)
}
}
position->s_score = score;
- (void) strncpy(position->s_name,whoami,MAXSTR);
+ (void) snprintf(position->s_name, MAXSTR, "%s", whoami);
position->s_eaten = eaten;
position->s_level = LEVEL;
position->s_uid = uid;
@@ -187,14 +187,15 @@ do_score(bool eaten, int fd, int max_days, char *type_str)
void
scorer()
{
- static char tels[6];
+ static char tels[32]; /* originally 6, but this generates warnings */
if(free_teleports != old_free) {
if(free_teleports > free_per_level) {
- (void) sprintf(tels,"%d+%d",
+ (void) snprintf(tels, sizeof(tels), "%d+%d",
free_per_level,
free_teleports-free_per_level);
} else {
- (void) sprintf(tels,"%d",free_teleports);
+ (void) snprintf(tels, sizeof(tels), "%d",
+ free_teleports);
}
old_free = free_teleports;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-07 11:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 11:22 [robots - The game; Fight against maniac robots] branch master, updated. f021172a007888eac5bcb6c6e33eedc030f1dece Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).