From d4e0194ce2ecccc654d57d86de8e10f1c9d7fac1 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Sun, 14 Jul 2013 23:00:39 +0000 Subject: [PATCH] (trunk, libT) #5275: fix platform quota crash on solaris 2.12, patch by godot --- libtransmission/platform-quota.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/libtransmission/platform-quota.c b/libtransmission/platform-quota.c index fbae54724..035590e6f 100644 --- a/libtransmission/platform-quota.c +++ b/libtransmission/platform-quota.c @@ -27,6 +27,9 @@ #endif #ifdef HAVE_GETMNTENT #ifdef __sun + #include + #include + #include #include #include #include @@ -73,16 +76,16 @@ getdev (const char * path) FILE * fp; #ifdef __sun - struct mnttab * mnt; + struct mnttab mnt; fp = fopen(_PATH_MOUNTED, "r"); if (fp == NULL) return NULL; - while (getmntent(fp, mnt)) - if (!tr_strcmp0 (path, mnt->mnt_mountp)) + while (getmntent(fp, &mnt)) + if (!tr_strcmp0 (path, mnt.mnt_mountp)) break; fclose(fp); - return mnt ? mnt->mnt_fstype : NULL; + return mnt.mnt_special; #else struct mntent * mnt; @@ -124,15 +127,15 @@ getfstype (const char * device) FILE * fp; #ifdef __sun - struct mnttab *mnt; + struct mnttab mnt; fp = fopen(_PATH_MOUNTED, "r"); if (fp == NULL) return NULL; - while (getmntent(fp, mnt)) - if (!tr_strcmp0 (device, mnt->mnt_mountp)) + while (getmntent(fp, &mnt)) + if (!tr_strcmp0 (device, mnt.mnt_mountp)) break; fclose(fp); - return mnt ? mnt->mnt_fstype : NULL; + return mnt.mnt_fstype; #else struct mntent *mnt; -- 2.40.0