diff mbox

[5/5] libselinux: remove unused variable usercon

Message ID 20180413203424.20542-5-nicolas.iooss@m4x.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Nicolas Iooss April 13, 2018, 8:34 p.m. UTC
In getconlist.c, main() does not use usercon. Remove this variable.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libselinux/utils/getconlist.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

William Roberts April 14, 2018, 12:40 a.m. UTC | #1
In general this series looks fine.

However, checkpatch.pl is complaining about DOS line endings in your patches:

For example:
ERROR: DOS line endings
#325: FILE: libselinux/src/label_file.h:281:
+^I^Iint alloc_stems = data->alloc_stems * 2 + 16;^M$





On Fri, Apr 13, 2018 at 1:34 PM, Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
> In getconlist.c, main() does not use usercon. Remove this variable.
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
> ---
>  libselinux/utils/getconlist.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libselinux/utils/getconlist.c b/libselinux/utils/getconlist.c
> index abfe2c742bfb..5ac0ca85075c 100644
> --- a/libselinux/utils/getconlist.c
> +++ b/libselinux/utils/getconlist.c
> @@ -19,7 +19,7 @@ static __attribute__ ((__noreturn__)) void usage(const char *name, const char *d
>
>  int main(int argc, char **argv)
>  {
> -       char **list, *usercon = NULL, *cur_context = NULL;
> +       char **list, *cur_context = NULL;
>         char *user = NULL, *level = NULL;
>         int ret, i, opt;
>
> @@ -69,7 +69,6 @@ int main(int argc, char **argv)
>                 freeconary(list);
>         }
>
> -       free(usercon);
>         free(level);
>
>         return 0;
> --
> 2.17.0
>
>
Nicolas Iooss April 14, 2018, 7:05 a.m. UTC | #2
On Sat, Apr 14, 2018 at 2:40 AM, William Roberts
<bill.c.roberts@gmail.com> wrote:
> In general this series looks fine.
>
> However, checkpatch.pl is complaining about DOS line endings in your patches:
>
> For example:
> ERROR: DOS line endings
> #325: FILE: libselinux/src/label_file.h:281:
> +^I^Iint alloc_stems = data->alloc_stems * 2 + 16;^M$

This is unexpected. On my computer, "file" gives the following output
on the .patch files (there is no "..., with CRLF line terminators"):

  0001-libsepol-do-not-dereference-NULL-if-stack_init-fails.patch:
unified diff output, ASCII text
  0002-libsepol-ensure-the-level-context-is-not-empty.patch:
unified diff output, ASCII text
  0003-libselinux-label_file-fix-memory-management-in-store.patch:
unified diff output, ASCII text
  0004-libselinux-fix-memory-leak-in-getconlist.patch:
unified diff output, ASCII text
  0005-libselinux-remove-unused-variable-usercon.patch:
unified diff output, ASCII text

Nevertheless, my messages seem to use CR+LF line endings. I am
wondering whether this is a new feature of "git send-email" or of my
SMTP server mangling text emails... Anyway, "git am *.patch && git
format-patch origin/master" produces files with LF line endings, so
git seems to handle fine this kind of modification.
By the way, I have also pushed these patches on my Github repository,
https://github.com/fishilico/selinux/commits/92717db1cb9dd6c8faf8fae3325f6a9d4c1002ca
.

Thanks!
Nicolas
Stephen Smalley April 16, 2018, 12:34 p.m. UTC | #3
On 04/13/2018 08:40 PM, William Roberts wrote:
> In general this series looks fine.
> 
> However, checkpatch.pl is complaining about DOS line endings in your patches:
> 
> For example:
> ERROR: DOS line endings
> #325: FILE: libselinux/src/label_file.h:281:
> +^I^Iint alloc_stems = data->alloc_stems * 2 + 16;^M$

If needed, dos2unix can be used to strip them. However, I think git am takes care of this for you.

> 
> 
> 
> 
> 
> On Fri, Apr 13, 2018 at 1:34 PM, Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>> In getconlist.c, main() does not use usercon. Remove this variable.
>>
>> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
>> ---
>>  libselinux/utils/getconlist.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/libselinux/utils/getconlist.c b/libselinux/utils/getconlist.c
>> index abfe2c742bfb..5ac0ca85075c 100644
>> --- a/libselinux/utils/getconlist.c
>> +++ b/libselinux/utils/getconlist.c
>> @@ -19,7 +19,7 @@ static __attribute__ ((__noreturn__)) void usage(const char *name, const char *d
>>
>>  int main(int argc, char **argv)
>>  {
>> -       char **list, *usercon = NULL, *cur_context = NULL;
>> +       char **list, *cur_context = NULL;
>>         char *user = NULL, *level = NULL;
>>         int ret, i, opt;
>>
>> @@ -69,7 +69,6 @@ int main(int argc, char **argv)
>>                 freeconary(list);
>>         }
>>
>> -       free(usercon);
>>         free(level);
>>
>>         return 0;
>> --
>> 2.17.0
>>
>>
>
William Roberts April 16, 2018, 3:30 p.m. UTC | #4
On Mon, Apr 16, 2018 at 5:34 AM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On 04/13/2018 08:40 PM, William Roberts wrote:
>> In general this series looks fine.
>>
>> However, checkpatch.pl is complaining about DOS line endings in your patches:
>>
>> For example:
>> ERROR: DOS line endings
>> #325: FILE: libselinux/src/label_file.h:281:
>> +^I^Iint alloc_stems = data->alloc_stems * 2 + 16;^M$
>
> If needed, dos2unix can be used to strip them. However, I think git am takes care of this for you.
>

FYI your patches are staged here:
https://github.com/SELinuxProject/selinux/pull/93

If no one nacks them, ill merge latter this week. Thanks.

>>
>>
>>
>>
>>
>> On Fri, Apr 13, 2018 at 1:34 PM, Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>>> In getconlist.c, main() does not use usercon. Remove this variable.
>>>
>>> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
>>> ---
>>>  libselinux/utils/getconlist.c | 3 +--
>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/libselinux/utils/getconlist.c b/libselinux/utils/getconlist.c
>>> index abfe2c742bfb..5ac0ca85075c 100644
>>> --- a/libselinux/utils/getconlist.c
>>> +++ b/libselinux/utils/getconlist.c
>>> @@ -19,7 +19,7 @@ static __attribute__ ((__noreturn__)) void usage(const char *name, const char *d
>>>
>>>  int main(int argc, char **argv)
>>>  {
>>> -       char **list, *usercon = NULL, *cur_context = NULL;
>>> +       char **list, *cur_context = NULL;
>>>         char *user = NULL, *level = NULL;
>>>         int ret, i, opt;
>>>
>>> @@ -69,7 +69,6 @@ int main(int argc, char **argv)
>>>                 freeconary(list);
>>>         }
>>>
>>> -       free(usercon);
>>>         free(level);
>>>
>>>         return 0;
>>> --
>>> 2.17.0
>>>
>>>
>>
>
James Carter April 16, 2018, 4:47 p.m. UTC | #5
On 04/16/2018 11:30 AM, William Roberts wrote:
> On Mon, Apr 16, 2018 at 5:34 AM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>> On 04/13/2018 08:40 PM, William Roberts wrote:
>>> In general this series looks fine.
>>>
>>> However, checkpatch.pl is complaining about DOS line endings in your patches:
>>>
>>> For example:
>>> ERROR: DOS line endings
>>> #325: FILE: libselinux/src/label_file.h:281:
>>> +^I^Iint alloc_stems = data->alloc_stems * 2 + 16;^M$
>>
>> If needed, dos2unix can be used to strip them. However, I think git am takes care of this for you.
>>
> 
> FYI your patches are staged here:
> https://github.com/SELinuxProject/selinux/pull/93
> 
> If no one nacks them, ill merge latter this week. Thanks.
> 

These patches look good to me.

Thanks,
Jim

>>>
>>>
>>>
>>>
>>>
>>> On Fri, Apr 13, 2018 at 1:34 PM, Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>>>> In getconlist.c, main() does not use usercon. Remove this variable.
>>>>
>>>> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
>>>> ---
>>>>   libselinux/utils/getconlist.c | 3 +--
>>>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>>>
>>>> diff --git a/libselinux/utils/getconlist.c b/libselinux/utils/getconlist.c
>>>> index abfe2c742bfb..5ac0ca85075c 100644
>>>> --- a/libselinux/utils/getconlist.c
>>>> +++ b/libselinux/utils/getconlist.c
>>>> @@ -19,7 +19,7 @@ static __attribute__ ((__noreturn__)) void usage(const char *name, const char *d
>>>>
>>>>   int main(int argc, char **argv)
>>>>   {
>>>> -       char **list, *usercon = NULL, *cur_context = NULL;
>>>> +       char **list, *cur_context = NULL;
>>>>          char *user = NULL, *level = NULL;
>>>>          int ret, i, opt;
>>>>
>>>> @@ -69,7 +69,6 @@ int main(int argc, char **argv)
>>>>                  freeconary(list);
>>>>          }
>>>>
>>>> -       free(usercon);
>>>>          free(level);
>>>>
>>>>          return 0;
>>>> --
>>>> 2.17.0
>>>>
>>>>
>>>
>>
> 
>
diff mbox

Patch

diff --git a/libselinux/utils/getconlist.c b/libselinux/utils/getconlist.c
index abfe2c742bfb..5ac0ca85075c 100644
--- a/libselinux/utils/getconlist.c
+++ b/libselinux/utils/getconlist.c
@@ -19,7 +19,7 @@  static __attribute__ ((__noreturn__)) void usage(const char *name, const char *d
 
 int main(int argc, char **argv)
 {
-	char **list, *usercon = NULL, *cur_context = NULL;
+	char **list, *cur_context = NULL;
 	char *user = NULL, *level = NULL;
 	int ret, i, opt;
 
@@ -69,7 +69,6 @@  int main(int argc, char **argv)
 		freeconary(list);
 	}
 
-	free(usercon);
 	free(level);
 
 	return 0;