MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / mode_string

Function mode_string

src/dir.c:117–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117void mode_string (const unsigned int mode, char *str)
118{
119#ifndef DISABLED_FOR_FRAMAC
120 str[0] = ftypelet(mode);
121 str[1] = (mode & LINUX_S_IRUSR) ? 'r' : '-';
122 str[2] = (mode & LINUX_S_IWUSR) ? 'w' : '-';
123 str[3] = (mode & LINUX_S_IXUSR) ? 'x' : '-';
124 str[4] = (mode & LINUX_S_IRGRP) ? 'r' : '-';
125 str[5] = (mode & LINUX_S_IWGRP) ? 'w' : '-';
126 str[6] = (mode & LINUX_S_IXGRP) ? 'x' : '-';
127 str[7] = (mode & LINUX_S_IROTH) ? 'r' : '-';
128 str[8] = (mode & LINUX_S_IWOTH) ? 'w' : '-';
129 str[9] = (mode & LINUX_S_IXOTH) ? 'x' : '-';
130 str[10]='\0';
131#ifdef LINUX_S_ISUID
132 if (mode & LINUX_S_ISUID)
133 {
134 if (str[3] != 'x')
135 /* Set-uid, but not executable by owner. */
136 str[3] = 'S';
137 else
138 str[3] = 's';
139 }
140#endif
141#ifdef LINUX_S_ISGID
142 if (mode & LINUX_S_ISGID)
143 {
144 if (str[6] != 'x')
145 /* Set-gid, but not executable by group. */
146 str[6] = 'S';
147 else
148 str[6] = 's';
149 }
150#endif
151#ifdef LINUX_S_ISVTX
152 if (mode & LINUX_S_ISVTX)
153 {
154 if (str[9] != 'x')
155 /* Sticky, but not executable by others. */
156 str[9] = 'T';
157 else
158 str[9] = 't';
159 }
160#endif
161#endif
162}
163
164int set_datestr(char *datestr, size_t n, const time_t timev)
165{

Callers 5

dir_aff_entryFunction · 0.85
dir_aff_ncursesFunction · 0.85
dir_aff_logFunction · 0.85
log_list_fileFunction · 0.85
ask_root_directoryFunction · 0.85

Calls 1

ftypeletFunction · 0.85

Tested by

no test coverage detected