From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-897093-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id F2CFB13832E
	for <garchives@archives.gentoo.org>; Mon, 15 Aug 2016 18:48:52 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id B29EEE0BCF;
	Mon, 15 Aug 2016 18:48:51 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 32EC8E0BCF
	for <gentoo-commits@lists.gentoo.org>; Mon, 15 Aug 2016 18:48:51 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 48AA9340FBC
	for <gentoo-commits@lists.gentoo.org>; Mon, 15 Aug 2016 18:48:50 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 2EF757DD
	for <gentoo-commits@lists.gentoo.org>; Mon, 15 Aug 2016 18:48:48 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1469985896.ca8c29ee60b0e8ca89091aaf801725bd71e28001.williamh@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: src/librc/
X-VCS-Repository: proj/openrc
X-VCS-Files: src/librc/librc.c
X-VCS-Directories: src/librc/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: ca8c29ee60b0e8ca89091aaf801725bd71e28001
X-VCS-Branch: master
Date: Mon, 15 Aug 2016 18:48:48 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 8a12deba-b20d-418b-a74a-5eb28c556ddd
X-Archives-Hash: 3d8600a1f3ac6ecdd27296ea0a0a2a23

commit:     ca8c29ee60b0e8ca89091aaf801725bd71e28001
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sun Jul 31 17:24:56 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Jul 31 17:24:56 2016 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=ca8c29ee

librc: fix Docker auto detection

The original auto detection of Docker containers assumed the presence of
a container environment variable. However, Docker-1.12 does not
implement this, and I'm not sure which versions of docker implemented
it.

The new test is for the presence of a file named .dockerenv in the
root directory.

 src/librc/librc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/librc/librc.c b/src/librc/librc.c
index 3e1f0d8..fdde3d5 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -285,6 +285,9 @@ detect_container(const char *systype)
 		return RC_SYS_RKT;
 	else if (file_regex("/proc/1/environ", "container=systemd-nspawn"))
 		return RC_SYS_SYSTEMD_NSPAWN;
+	else if (exists("/.dockerenv"))
+		return RC_SYS_DOCKER;
+	/* old test, I'm not sure when this was valid. */
 	else if (file_regex("/proc/1/environ", "container=docker"))
 		return RC_SYS_DOCKER;
 #endif