1 Star 0 Fork 58

gnaygnil/docker

forked from src-openEuler/docker 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0022-umask-fix-nil-pointer-on-c.Annotations-in-set.patch 1.42 KB
一键复制 编辑 原始数据 按行查看 历史
gnaygnil 提交于 2020-02-13 15:36 . docker: Fixed build error and URL
From 412b8a34a2aa40ddf6f9b507142c4793922cedf5 Mon Sep 17 00:00:00 2001
From: lujingxiao <lujingxiao@huawei.com>
Date: Sat, 19 Jan 2019 11:22:46 +0800
Subject: [PATCH 022/111] umask: fix nil pointer on c.Annotations in
setUmask
reason: c.Annotations should be check before using in setUmask().
When "/create" request is sent via restful api, the c.Annotations
is nil, so **nil map** happens in setUmask.
Change-Id: Idafa2d8d1f54c1ebc34a6380d64c1cd7efad0266
Signed-off-by: lujingxiao <lujingxiao@huawei.com>
---
components/engine/daemon/create.go | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/components/engine/daemon/create.go b/components/engine/daemon/create.go
index fa000c2208..b57b01eacc 100644
--- a/components/engine/daemon/create.go
+++ b/components/engine/daemon/create.go
@@ -86,10 +86,15 @@ func (daemon *Daemon) setUmask(c *containertypes.Config) error {
if val != umaskNormal && val != umaskSecure {
return fmt.Errorf("native.umask option %s not supported", val)
}
- } else if UsingNormalUmask(daemon.configStore) {
- c.Annotations["native.umask"] = umaskNormal
} else {
- c.Annotations["native.umask"] = umaskSecure
+ if c.Annotations == nil {
+ c.Annotations = make(map[string]string)
+ }
+ if UsingNormalUmask(daemon.configStore) {
+ c.Annotations["native.umask"] = umaskNormal
+ } else {
+ c.Annotations["native.umask"] = umaskSecure
+ }
}
return nil
--
2.17.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gnaygnil/docker.git
git@gitee.com:gnaygnil/docker.git
gnaygnil
docker
docker
master

搜索帮助