svn commit: r303280 - stable/10/usr.bin/mail

2016-07-24 Thread Xin LI
Author: delphij
Date: Mon Jul 25 00:46:01 2016
New Revision: 303280
URL: https://svnweb.freebsd.org/changeset/base/303280

Log:
  MFC r302542:
  
  Use _PATH_DEVNULL instead of hardcoding.

Modified:
  stable/10/usr.bin/mail/collect.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/mail/collect.c
==
--- stable/10/usr.bin/mail/collect.cSun Jul 24 23:40:33 2016
(r303279)
+++ stable/10/usr.bin/mail/collect.cMon Jul 25 00:46:01 2016
(r303280)
@@ -339,9 +339,9 @@ cont:
int nullfd, tempfd, rc;
char tempname2[PATHSIZE];
 
-   if ((nullfd = open("/dev/null", O_RDONLY, 0))
+   if ((nullfd = open(_PATH_DEVNULL, O_RDONLY, 0))
== -1) {
-   warn("/dev/null");
+   warn(_PATH_DEVNULL);
break;
}
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r303257 - in stable/10/usr.sbin/pw: . tests

2016-07-24 Thread Baptiste Daroussin
Author: bapt
Date: Sun Jul 24 08:21:21 2016
New Revision: 303257
URL: https://svnweb.freebsd.org/changeset/base/303257

Log:
  Do not try to delete the home of the user if is is not a directory for example
  "/dev/null"
  
  PR:   211195
  Submitted by: rday 
  Reported by:  eniorm 

Modified:
  stable/10/usr.sbin/pw/rm_r.c
  stable/10/usr.sbin/pw/tests/pw_userdel.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/pw/rm_r.c
==
--- stable/10/usr.sbin/pw/rm_r.cSun Jul 24 08:12:23 2016
(r303256)
+++ stable/10/usr.sbin/pw/rm_r.cSun Jul 24 08:21:21 2016
(r303257)
@@ -50,6 +50,9 @@ rm_r(int rootfd, const char *path, uid_t
path++;
 
dirfd = openat(rootfd, path, O_DIRECTORY);
+   if (dirfd == -1) {
+   return;
+   }
 
d = fdopendir(dirfd);
while ((e = readdir(d)) != NULL) {

Modified: stable/10/usr.sbin/pw/tests/pw_userdel.sh
==
--- stable/10/usr.sbin/pw/tests/pw_userdel.sh   Sun Jul 24 08:12:23 2016
(r303256)
+++ stable/10/usr.sbin/pw/tests/pw_userdel.sh   Sun Jul 24 08:21:21 2016
(r303257)
@@ -59,9 +59,18 @@ delete_numeric_name_body() {
${PW} userdel -n 4001
 }
 
+atf_test_case home_not_a_dir
+home_not_a_dir_body() {
+   populate_root_etc_skel
+   touch ${HOME}/foo
+   atf_check ${RPW} useradd foo -d /foo
+   atf_check ${RPW} userdel foo -r
+}
+
 atf_init_test_cases() {
atf_add_test_case rmuser_seperate_group
atf_add_test_case user_do_not_try_to_delete_root_if_user_unknown
atf_add_test_case delete_files
atf_add_test_case delete_numeric_name
+   atf_add_test_case home_not_a_dir
 }
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"