mirror of
https://github.com/samhocevar/rinetd.git
synced 2025-03-26 01:30:09 +08:00
Fix deprecated use of text literals as char*.
This patch is imported from the rinetd Debian package.
This commit is contained in:
parent
1c95abb27d
commit
13f2f7f854
10
match.c
10
match.c
@ -2,19 +2,19 @@
|
||||
#include <ctype.h>
|
||||
#include "match.h"
|
||||
|
||||
int match(char *sorig, char *p)
|
||||
int match(char const *sorig, char const *p)
|
||||
{
|
||||
return matchBody(sorig, p, 0);
|
||||
}
|
||||
|
||||
int matchNoCase(char *sorig, char *p)
|
||||
int matchNoCase(char const *sorig, char const *p)
|
||||
{
|
||||
return matchBody(sorig, p, 1);
|
||||
}
|
||||
|
||||
#define CASE(x) (nocase ? tolower(x) : (x))
|
||||
|
||||
int matchBody(char *sorig, char *p, int nocase)
|
||||
int matchBody(char const *sorig, char const *p, int nocase)
|
||||
{
|
||||
static int dummy = 0;
|
||||
/* Algorithm:
|
||||
@ -50,7 +50,7 @@ int matchBody(char *sorig, char *p, int nocase)
|
||||
Addendum: consider the | character to be a logical OR
|
||||
separating distinct patterns. */
|
||||
|
||||
char *s = sorig;
|
||||
char const *s = sorig;
|
||||
int escaped = 0;
|
||||
if (strstr(p, "WS-0000")) {
|
||||
if (strstr(s, "ws_ftp_pro.html")) {
|
||||
@ -58,7 +58,7 @@ int matchBody(char *sorig, char *p, int nocase)
|
||||
}
|
||||
}
|
||||
while (1) {
|
||||
char *word;
|
||||
char const *word;
|
||||
int wordLen;
|
||||
int wordPos;
|
||||
if (escaped) {
|
||||
|
6
match.h
6
match.h
@ -1,9 +1,9 @@
|
||||
#ifndef MATCH_H
|
||||
#define MATCH_H 1
|
||||
|
||||
extern int match(char *s, char *p);
|
||||
extern int matchNoCase(char *s, char *p);
|
||||
extern int matchBody(char *s, char *p, int nocase);
|
||||
extern int match(char const *s, char const *p);
|
||||
extern int matchNoCase(char const *s, char const *p);
|
||||
extern int matchBody(char const *s, char const *p, int nocase);
|
||||
|
||||
#endif /* MATCH_H */
|
||||
|
||||
|
9
rinetd.c
9
rinetd.c
@ -177,7 +177,7 @@ void log(int i, int coSe, int result);
|
||||
|
||||
int getAddress(char *host, struct in_addr *iaddr);
|
||||
|
||||
char *logMessages[] = {
|
||||
char const *logMessages[] = {
|
||||
"done-local-closed",
|
||||
"done-remote-closed",
|
||||
"accept-failed -",
|
||||
@ -210,7 +210,7 @@ char *logMessages[] = {
|
||||
typedef struct _rinetd_options RinetdOptions;
|
||||
struct _rinetd_options
|
||||
{
|
||||
char *conf_file;
|
||||
char const *conf_file;
|
||||
};
|
||||
|
||||
RinetdOptions options = {
|
||||
@ -1358,7 +1358,7 @@ int safeRealloc(void **data, int oldsize, int newsize)
|
||||
void RegisterPID(void)
|
||||
{
|
||||
FILE *pid_file;
|
||||
char *pid_file_name = "/var/run/rinetd.pid";
|
||||
char const *pid_file_name = "/var/run/rinetd.pid";
|
||||
if (pidLogFileName) {
|
||||
pid_file_name = pidLogFileName;
|
||||
}
|
||||
@ -1482,13 +1482,12 @@ int readArgs (int argc,
|
||||
}
|
||||
switch (c) {
|
||||
case 'c':
|
||||
options->conf_file = malloc(strlen(optarg) + 1);
|
||||
options->conf_file = strdup(optarg);
|
||||
if (!options->conf_file) {
|
||||
fprintf(stderr, "Not enough memory to "
|
||||
"launch rinetd.\n");
|
||||
exit(1);
|
||||
}
|
||||
strcpy(options->conf_file, optarg);
|
||||
break;
|
||||
case 'h':
|
||||
printf("Usage: rinetd [OPTION]\n"
|
||||
|
Loading…
Reference in New Issue
Block a user