[PATCH v3 01/15] util: move getusername to util.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jeff Layton <jlayton@xxxxxxxxx>
---
 mount.cifs.c |   11 -----------
 util.c       |   13 +++++++++++++
 util.h       |    1 +
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/mount.cifs.c b/mount.cifs.c
index 147f7fc..ced9f4e 100644
--- a/mount.cifs.c
+++ b/mount.cifs.c
@@ -361,17 +361,6 @@ static int set_password(struct parsed_mount_info *parsed_info, const char *src)
 	return 0;
 }
 
-/* caller frees username if necessary */
-static char *getusername(uid_t uid)
-{
-	char *username = NULL;
-	struct passwd *password = getpwuid(uid);
-
-	if (password)
-		username = password->pw_name;
-	return username;
-}
-
 /*
  * Parse a username string into parsed_mount_info fields. The format is:
  *
diff --git a/util.c b/util.c
index 41c6784..80d5a80 100644
--- a/util.c
+++ b/util.c
@@ -24,6 +24,7 @@
 
 #include <sys/types.h>
 #include <string.h>
+#include <pwd.h>
 
 /* glibc doesn't have strlcpy, strlcat. Ensure we do. JRA. We
  * don't link to libreplace so need them here. */
@@ -69,3 +70,15 @@ size_t strlcat(char *d, const char *s, size_t bufsize)
 }
 #endif
 
+/* caller frees username if necessary */
+char *
+getusername(uid_t uid)
+{
+	char *username = NULL;
+	struct passwd *password = getpwuid(uid);
+
+	if (password)
+		username = password->pw_name;
+	return username;
+}
+
diff --git a/util.h b/util.h
index 7a44faf..d3ca015 100644
--- a/util.h
+++ b/util.h
@@ -28,5 +28,6 @@
 size_t strlcpy(char *d, const char *s, size_t bufsize);
 size_t strlcat(char *d, const char *s, size_t bufsize);
 
+char *getusername(uid_t uid);
 #endif /* _LIBUTIL_H */
 
-- 
1.7.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux