mirror of
https://github.com/kingk85/uFTP.git
synced 2025-04-12 10:48:40 +03:00
Getgroupowner and GetOwner fixes
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
dist/Debug/GNU-Linux/uftp
vendored
BIN
dist/Debug/GNU-Linux/uftp
vendored
Binary file not shown.
@ -276,6 +276,7 @@ int writeListDataInfoToSocket(char * thePath, int theSocket, int *filesNumber, i
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//printf("\nFILE SIZE : %lld", data.fileSize);
|
||||
|
||||
data.owner = FILE_GetOwner(fileList[i]);
|
||||
|
@ -471,19 +471,20 @@ char * FILE_GetListPermissionsString(char *file) {
|
||||
|
||||
char * FILE_GetOwner(char *fileName)
|
||||
{
|
||||
int returnCode = 0;
|
||||
char *toReturn;
|
||||
struct stat info;
|
||||
if (stat(fileName, &info) == -1 )
|
||||
|
||||
if ((returnCode = stat(fileName, &info)) == -1)
|
||||
return NULL;
|
||||
|
||||
struct passwd *pw = getpwuid(info.st_uid);
|
||||
|
||||
if (pw->pw_name == 0)
|
||||
struct passwd *pw;
|
||||
if ( (pw = getpwuid(info.st_uid)) == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
toReturn = (char *) malloc (strlen(pw->pw_name) + 1);
|
||||
strcpy(toReturn, pw->pw_name);
|
||||
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@ -493,9 +494,9 @@ char * FILE_GetGroupOwner(char *fileName)
|
||||
struct stat info;
|
||||
if (stat(fileName, &info) == -1 )
|
||||
return NULL;
|
||||
struct group *gr = getgrgid(info.st_gid);
|
||||
struct group *gr;
|
||||
|
||||
if (gr->gr_name == 0)
|
||||
if ((gr = getgrgid(info.st_gid)) == NULL)
|
||||
return NULL;
|
||||
|
||||
toReturn = (char *) malloc (strlen(gr->gr_name) + 1);
|
||||
|
@ -6,8 +6,6 @@
|
||||
</data>
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/home/ugo/NetBeansProjects/uFTP/uftpd.cfg</file>
|
||||
</group>
|
||||
<group/>
|
||||
</open-files>
|
||||
</project-private>
|
||||
|
Reference in New Issue
Block a user