Fix defects in cgroup ops.
Fix defects in cgroup ops.

This patch is to fix below defects reported by Coverity Scan.

```
New defect(s) Reported-by: Coverity Scan
Showing 3 of 3 defect(s)

** CID 169611:  Security best practices violations  (TOCTOU)
/tmp/build/0e1b53a0/gpdb_src/src/backend/utils/resgroup/resgroup-ops-cgroup.c:
272 in createDir()

________________________________________________________________________________________________________
*** CID 169611:  Security best practices violations  (TOCTOU)
/tmp/build/0e1b53a0/gpdb_src/src/backend/utils/resgroup/resgroup-ops-cgroup.c:
272 in createDir()
266
267             buildPath(group, comp, "", path, pathsize);
268
269             if (access(path, F_OK))
270             {
271                     /* the dir is not created yet, create it */
>>>     CID 169611:  Security best practices violations  (TOCTOU)
>>>     Calling function "mkdir" that uses "path" after a check
>>>     function. This can cause a time-of-check, time-of-use race
>>>     condition.
272                     if (mkdir(path, 0755) && errno != EEXIST)
273                             return false;
274             }
275
276             return true;
277     }

** CID 169610:  Control flow issues  (NO_EFFECT)
/tmp/build/0e1b53a0/gpdb_src/src/backend/utils/resgroup/resgroup-ops-cgroup.c:
412 in writeData()

________________________________________________________________________________________________________
*** CID 169610:  Control flow issues  (NO_EFFECT)
/tmp/build/0e1b53a0/gpdb_src/src/backend/utils/resgroup/resgroup-ops-cgroup.c:
412 in writeData()
406             size_t ret = write(fd, data, datasize);
407
408             /* save errno before close */
409             int err = errno;
410             close(fd);
411
>>>     CID 169610:  Control flow issues  (NO_EFFECT)
>>>     This less-than-zero comparison of an unsigned value is never
>>>     true. "ret < 0UL".
412             if (ret < 0)
413                     CGROUP_ERROR("can't write data to file '%s':
%s", path, strerror(err));
414             if (ret != datasize)
415                     CGROUP_ERROR("can't write all data to file
'%s'", path);
416     }
417

** CID 169609:  Control flow issues  (NO_EFFECT)
/tmp/build/0e1b53a0/gpdb_src/src/backend/utils/resgroup/resgroup-ops-cgroup.c:
385 in readData()

________________________________________________________________________________________________________
*** CID 169609:  Control flow issues  (NO_EFFECT)
/tmp/build/0e1b53a0/gpdb_src/src/backend/utils/resgroup/resgroup-ops-cgroup.c:
385 in readData()
379             size_t ret = read(fd, data, datasize);
380
381             /* save errno before close() */
382             int err = errno;
383             close(fd);
384
>>>     CID 169609:  Control flow issues  (NO_EFFECT)
>>>     This less-than-zero comparison of an unsigned value is never
>>>     true. "ret < 0UL".
385             if (ret < 0)
386                     CGROUP_ERROR("can't read data from file '%s':
%s", path, strerror(err));
387
388             return ret;
389     }
390
```

edespino/gpdb,cjcjameson/gpdb,Quikling/gpdb,Chibin/gpdb,rvs/gpdb,Chibin/gpdb,Chibin/gpdb,janebeckman/gpdb,ashwinstar/gpdb,Quikling/gpdb,50wu/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,jmcatamney/gpdb,lisakowen/gpdb,greenplum-db/gpdb,xinzweb/gpdb,edespino/gpdb,yuanzhao/gpdb,kaknikhil/gpdb,cjcjameson/gpdb,Chibin/gpdb,greenplum-db/gpdb,kaknikhil/gpdb,Quikling/gpdb,edespino/gpdb,rvs/gpdb,50wu/gpdb,kaknikhil/gpdb,janebeckman/gpdb,xinzweb/gpdb,jmcatamney/gpdb,xinzweb/gpdb,ashwinstar/gpdb,rvs/gpdb,adam8157/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,Chibin/gpdb,jmcatamney/gpdb,janebeckman/gpdb,50wu/gpdb,ashwinstar/gpdb,lisakowen/gpdb,edespino/gpdb,50wu/gpdb,adam8157/gpdb,kaknikhil/gpdb,janebeckman/gpdb,50wu/gpdb,rvs/gpdb,xinzweb/gpdb,lisakowen/gpdb,janebeckman/gpdb,yuanzhao/gpdb,kaknikhil/gpdb,lisakowen/gpdb,Chibin/gpdb,Chibin/gpdb,Quikling/gpdb,jmcatamney/gpdb,yuanzhao/gpdb,yuanzhao/gpdb,greenplum-db/gpdb,cjcjameson/gpdb,yuanzhao/gpdb,edespino/gpdb,50wu/gpdb,yuanzhao/gpdb,cjcjameson/gpdb,adam8157/gpdb,edespino/gpdb,yuanzhao/gpdb,50wu/gpdb,Chibin/gpdb,adam8157/gpdb,xinzweb/gpdb,50wu/gpdb,greenplum-db/gpdb,lisakowen/gpdb,cjcjameson/gpdb,Quikling/gpdb,kaknikhil/gpdb,rvs/gpdb,janebeckman/gpdb,edespino/gpdb,xinzweb/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,xinzweb/gpdb,Quikling/gpdb,adam8157/gpdb,jmcatamney/gpdb,cjcjameson/gpdb,lisakowen/gpdb,ashwinstar/gpdb,adam8157/gpdb,adam8157/gpdb,Quikling/gpdb,ashwinstar/gpdb,rvs/gpdb,yuanzhao/gpdb,Quikling/gpdb,yuanzhao/gpdb,kaknikhil/gpdb,cjcjameson/gpdb,cjcjameson/gpdb,Chibin/gpdb,edespino/gpdb,janebeckman/gpdb,janebeckman/gpdb,Chibin/gpdb,xinzweb/gpdb,janebeckman/gpdb,Quikling/gpdb,lisakowen/gpdb,Quikling/gpdb,edespino/gpdb,greenplum-db/gpdb,rvs/gpdb,rvs/gpdb,cjcjameson/gpdb,jmcatamney/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,adam8157/gpdb,kaknikhil/gpdb,greenplum-db/gpdb,janebeckman/gpdb,greenplum-db/gpdb,cjcjameson/gpdb,rvs/gpdb,edespino/gpdb,rvs/gpdb,lisakowen/gpdb,kaknikhil/gpdb