Skip to content

Conversation

@alejandro-colomar
Copy link
Collaborator

@alejandro-colomar alejandro-colomar commented Oct 13, 2025

FTR: I'm not entirely sure if an empty string can arrive here. It might be that the streq() check is dead code, but I'm not sure, so I put it. It also makes the code more robust.


Revisions:

v1b
  • Rebase
$ git rd 
1:  5290b783 ! 1:  e6df54ea src/usermod.c: $user_newhome: Remove all trailing '/'s
    @@ src/usermod.c
      #include "time/day_to_str.h"
      #include "typetraits.h"
      
    -@@ src/usermod.c: static void new_pwent (struct passwd *pwent)
    +@@ src/usermod.c: static void new_pwent (struct passwd *pwent, bool process_selinux)
                         "change user '%s' home from '%s' to '%s'",
                         pwent->pw_name, pwent->pw_dir, user_newhome));
      
v1c
  • Rebase
$ git rd 
1:  e6df54ea ! 1:  89a8623f src/usermod.c: $user_newhome: Remove all trailing '/'s
    @@ src/usermod.c
     @@
      #include "string/strcmp/streq.h"
      #include "string/strcmp/strprefix.h"
    - #include "string/strdup/xstrdup.h"
    + #include "string/strdup/strdup.h"
     +#include "string/strspn/stprspn.h"
      #include "time/day_to_str.h"
      #include "typetraits.h"

@alejandro-colomar alejandro-colomar force-pushed the stprspn branch 2 times, most recently from be0fe17 to f9da434 Compare October 13, 2025 14:09
@alejandro-colomar alejandro-colomar changed the title src/usermod.c: Remove all trailing /s src/usermod.c: $user_home: Remove all trailing '/'s Oct 13, 2025
FTR: I'm not entirely sure if an empty string can arrive here.  It might
be that the streq() check is dead code, but I'm not sure, so I put it.
It also makes the code more robust.

Signed-off-by: Alejandro Colomar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant