On Monday 08 October 2007, Randy Dunlap wrote: > From: Randy Dunlap <randy.dunlap@xxxxxxxxxx> > > Fix gcc warnings from: > (try compilation with "-Wall -Wp,-D_FORTIFY_SOURCE=2") > > mount_mntent.c:28: warning: pointer targets in passing argument 1 of > 'strlen' differ in signedness mount_mntent.c:129: warning: pointer targets > in passing argument 1 of 'mangle' differ in signedness mount_mntent.c:130: > warning: pointer targets in passing argument 1 of 'mangle' differ in > signedness mount_mntent.c:131: warning: pointer targets in passing argument > 1 of 'mangle' differ in signedness mount_mntent.c:132: warning: pointer > targets in passing argument 1 of 'mangle' differ in signedness > > Signed-off-by: Randy Dunlap <randy.dunlap@xxxxxxxxxx> > --- > mount/mount_mntent.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > --- util-linux-ng-2.13.orig/mount/mount_mntent.c > +++ util-linux-ng-2.13/mount/mount_mntent.c > @@ -25,7 +25,7 @@ mangle(const unsigned char *s) { > char *ss, *sp; > int n; > > - n = strlen(s); > + n = strlen((const char *)s); > ss = sp = xmalloc(4*n+1); > while(1) { > for (n = 0; n < sizeof(need_escaping); n++) { > @@ -126,10 +126,10 @@ my_addmntent (mntFILE *mfp, struct my_mn > if (fseek (mfp->mntent_fp, 0, SEEK_END)) > return 1; /* failure */ > > - m1 = mangle(mnt->mnt_fsname); > - m2 = mangle(mnt->mnt_dir); > - m3 = mangle(mnt->mnt_type); > - m4 = mangle(mnt->mnt_opts); > + m1 = mangle((const unsigned char *)mnt->mnt_fsname); > + m2 = mangle((const unsigned char *)mnt->mnt_dir); > + m3 = mangle((const unsigned char *)mnt->mnt_type); > + m4 = mangle((const unsigned char *)mnt->mnt_opts); > > res = fprintf (mfp->mntent_fp, "%s %s %s %s %d %d\n", > m1, m2, m3, m4, mnt->mnt_freq, mnt->mnt_passno); considering mangle() works on filenames, and the signedness of such strings is irrelevant, why not change it to take a "char *" instead of adding ugly casts all over the place -mike
Attachment:
signature.asc
Description: This is a digitally signed message part.