*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include "actions.h"
guestfs_int_dirent_list *
-do_readdir (char *path)
+do_readdir (const char *path)
{
guestfs_int_dirent_list *ret;
guestfs_int_dirent v;
struct dirent *d;
int i;
- NEED_ROOT (return NULL);
- ABS_PATH (path, return NULL);
-
ret = malloc (sizeof *ret);
if (ret == NULL) {
reply_with_perror ("malloc");
ret->guestfs_int_dirent_list_val = p;
v.ino = d->d_ino;
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
switch (d->d_type) {
case DT_BLK: v.ftyp = 'b'; break;
case DT_CHR: v.ftyp = 'c'; break;
case DT_UNKNOWN: v.ftyp = 'u'; break;
default: v.ftyp = '?'; break;
}
+#else
+ v.ftyp = 'u';
+#endif
ret->guestfs_int_dirent_list_val[i] = v;