Tizen 2.1 base
[platform/upstream/sysvinit.git] / packaging / 70_compiler_warnings.patch
1 Purpose: Get rid of some signed/unsigned warnings.
2 Authour: Petter Reinholdtsen
3 Fixes:   -
4 Status:  Should be sent upstream.
5
6 --- a/src/bootlogd.c
7 +++ b/src/bootlogd.c
8 @@ -136,7 +136,7 @@ static int findtty(char *res, const char
9                 if (!S_ISCHR(st.st_mode))
10                         continue;
11                 if (st.st_rdev == dev) {
12 -                       if (strlen(ent->d_name) + strlen(startdir) + 1 >= rlen) {
13 +                       if ((int)strlen(ent->d_name) + (int)strlen(startdir) + 1 >= rlen) {
14                                 fprintf(stderr, "bootlogd: console device name too long\n");
15                                 closedir(dir);
16                                 chdir(olddir);
17 @@ -370,7 +370,7 @@ void writelog(FILE *fp, unsigned char *p
18                                 break;
19                         case '\t':
20                                 line.pos += (line.pos / 8 + 1) * 8;
21 -                               if (line.pos >= sizeof(line.buf))
22 +                               if (line.pos >= (int)sizeof(line.buf))
23                                         line.pos = sizeof(line.buf) - 1;
24                                 break;
25                         case  32 ... 127:
26 @@ -386,7 +386,7 @@ void writelog(FILE *fp, unsigned char *p
27                 len--;
28  
29                 tlen = strlen(tmp);
30 -               if (tlen && (line.pos + tlen < sizeof(line.buf))) {
31 +               if (tlen && (line.pos + tlen < (int)sizeof(line.buf))) {
32                         memcpy(line.buf + line.pos, tmp, tlen);
33                         line.pos += tlen;
34                 }
35 @@ -659,7 +659,7 @@ int main(int argc, char **argv)
36                 else
37                         todo = endptr - outptr;
38                 if (fp && todo)
39 -                       writelog(fp, outptr, todo);
40 +                       writelog(fp, (unsigned char *)outptr, todo);
41         }
42  
43         if (fp) {
44 --- a/src/init.c
45 +++ b/src/init.c
46 @@ -1256,7 +1256,7 @@ void read_inittab(void)
47         strncpy(ch->id, id, sizeof(utproto.ut_id) + 1); /* Hack for different libs. */
48         strncpy(ch->process, process, sizeof(ch->process) - 1);
49         if (rlevel[0]) {
50 -               for(f = 0; f < sizeof(rlevel) - 1 && rlevel[f]; f++) {
51 +               for(f = 0; f < (int)sizeof(rlevel) - 1 && rlevel[f]; f++) {
52                         ch->rlevel[f] = rlevel[f];
53                         if (ch->rlevel[f] == 's') ch->rlevel[f] = 'S';
54                 }
55 --- a/src/last.c
56 +++ b/src/last.c
57 @@ -322,7 +322,7 @@ int dns_lookup(char *result, int size, i
58          *
59          *      Ugly.
60          */
61 -       if (a[0] == 0 && a[1] == 0 && a[2] == htonl (0xffff))
62 +       if (a[0] == 0 && a[1] == 0 && a[2] == (int32_t)htonl (0xffff))
63                 mapped = 1;
64         topnibble = ntohl((unsigned int)a[0]) >> 28;
65  
66 @@ -453,7 +453,7 @@ int list(struct utmp *p, time_t t, int w
67                 r = dns_lookup(domain, sizeof(domain), useip, p->ut_addr_v6);
68         if (r < 0) {
69                 len = UT_HOSTSIZE;
70 -               if (len >= sizeof(domain)) len = sizeof(domain) - 1;
71 +               if (len >= (int)sizeof(domain)) len = sizeof(domain) - 1;
72                 domain[0] = 0;
73                 strncat(domain, p->ut_host, len);
74         }
75 --- a/src/shutdown.c
76 +++ b/src/shutdown.c
77 @@ -141,7 +141,7 @@ int init_setenv(char *name, char *value)
78         nl = strlen(name);
79         vl = value ? strlen(value) : 0;
80  
81 -       if (nl + vl + 3 >= sizeof(request.i.data))
82 +       if (nl + vl + 3 >= (int)sizeof(request.i.data))
83                 return -1;
84  
85         memcpy(request.i.data, name, nl);
86 --- a/src/sulogin.c
87 +++ b/src/sulogin.c
88 @@ -282,7 +282,7 @@ char *getpasswd(char *crypted)
89         if (read(0, pass, sizeof(pass) - 1) <= 0)
90                 ret = NULL;
91         else {
92 -               for(i = 0; i < sizeof(pass) && pass[i]; i++)
93 +               for(i = 0; i < (int)sizeof(pass) && pass[i]; i++)
94                         if (pass[i] == '\r' || pass[i] == '\n') {
95                                 pass[i] = 0;
96                                 break;