On Sun, Jun 23, 2013 at 04:23:17PM -0700, Tyler Hicks wrote: > The parameter names are slightly different in the two functions. Rename > buffer to buf and rename size to len to make the two function prototypes > look similar. > > Signed-off-by: Tyler Hicks <[email protected]>
Acked-by: Seth Arnold <[email protected]> > --- > libraries/libapparmor/src/apparmor.h | 2 +- > libraries/libapparmor/src/kernel_interface.c | 26 +++++++++++++------------- > libraries/libapparmor/swig/SWIG/libapparmor.i | 2 +- > 3 files changed, 15 insertions(+), 15 deletions(-) > > diff --git a/libraries/libapparmor/src/apparmor.h > b/libraries/libapparmor/src/apparmor.h > index 142d1e1..79bc69c 100644 > --- a/libraries/libapparmor/src/apparmor.h > +++ b/libraries/libapparmor/src/apparmor.h > @@ -48,7 +48,7 @@ extern int aa_getprocattr_raw(pid_t tid, const char *attr, > char *buf, int len, > extern int aa_getprocattr(pid_t tid, const char *attr, char **buf, char > **mode); > extern int aa_gettaskcon(pid_t target, char **con, char **mode); > extern int aa_getcon(char **con, char **mode); > -extern int aa_getpeercon_raw(int fd, char *buffer, int *size, char **mode); > +extern int aa_getpeercon_raw(int fd, char *buf, int *len, char **mode); > extern int aa_getpeercon(int fd, char **con, char **mode); > > #define __macroarg_counter(Y...) __macroarg_count1 ( , ##Y) > diff --git a/libraries/libapparmor/src/kernel_interface.c > b/libraries/libapparmor/src/kernel_interface.c > index 0c02d15..7524188 100644 > --- a/libraries/libapparmor/src/kernel_interface.c > +++ b/libraries/libapparmor/src/kernel_interface.c > @@ -561,35 +561,35 @@ int aa_getcon(char **con, char **mode) > /** > * aa_getpeercon_raw - get the confinement of the socket's peer (other end) > * @fd: socket to get peer confinement for > - * @con: pointer to buffer to store confinement string > - * @size: initially contains size of the buffer, returns size of data read > + * @buf: buffer to store the result in > + * @len: initially contains size of the buffer, returns size of data read > * @mode: if set will point to mode string within buffer if it is present > * > * Returns: length of confinement data including null termination or -1 on > error > - * if errno == ERANGE then @size will hold the size needed > + * if errno == ERANGE then @len will hold the size needed > */ > -int aa_getpeercon_raw(int fd, char *buffer, int *size, char **mode) > +int aa_getpeercon_raw(int fd, char *buf, int *len, char **mode) > { > - socklen_t optlen = *size; > + socklen_t optlen = *len; > char *mode_str; > int rc; > > - if (optlen <= 0 || buffer == NULL) { > + if (optlen <= 0 || buf == NULL) { > errno = EINVAL; > return -1; > } > > - rc = getsockopt(fd, SOL_SOCKET, SO_PEERSEC, buffer, &optlen); > + rc = getsockopt(fd, SOL_SOCKET, SO_PEERSEC, buf, &optlen); > if (rc == -1 || optlen <= 0) > goto out; > > /* check for null termination */ > - if (buffer[optlen - 1] != 0) { > - if (optlen < *size) { > - buffer[optlen] = 0; > + if (buf[optlen - 1] != 0) { > + if (optlen < *len) { > + buf[optlen] = 0; > optlen++; > } else { > - /* buffer needs to be bigger by 1 */ > + /* buf needs to be bigger by 1 */ > rc = -1; > errno = ERANGE; > optlen++; > @@ -597,13 +597,13 @@ int aa_getpeercon_raw(int fd, char *buffer, int *size, > char **mode) > } > } > > - mode_str = parse_confinement_mode(buffer, optlen); > + mode_str = parse_confinement_mode(buf, optlen); > if (mode) > *mode = mode_str; > > rc = optlen; > out: > - *size = optlen; > + *len = optlen; > return rc; > } > > diff --git a/libraries/libapparmor/swig/SWIG/libapparmor.i > b/libraries/libapparmor/swig/SWIG/libapparmor.i > index 13b86b8..1d3ca07 100644 > --- a/libraries/libapparmor/swig/SWIG/libapparmor.i > +++ b/libraries/libapparmor/swig/SWIG/libapparmor.i > @@ -25,5 +25,5 @@ extern int aa_getprocattr_raw(pid_t tid, const char *attr, > char *buf, int len, > extern int aa_getprocattr(pid_t tid, const char *attr, char **buf, char > **mode); > extern int aa_gettaskcon(pid_t target, char **con, char **mode); > extern int aa_getcon(char **con, char **mode); > -extern int aa_getpeercon_raw(int fd, char *buffer, int *size, char **mode); > +extern int aa_getpeercon_raw(int fd, char *buf, int *len, char **mode); > extern int aa_getpeercon(int fd, char **con, char **mode); > -- > 1.8.1.2 > > > -- > AppArmor mailing list > [email protected] > Modify settings or unsubscribe at: > https://lists.ubuntu.com/mailman/listinfo/apparmor >
signature.asc
Description: Digital signature
-- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
