summaryrefslogtreecommitdiff
path: root/actions/raw_action.go
diff options
context:
space:
mode:
authorHéctor Orón Martínez <zumbi@debian.org>2018-11-06 17:39:01 +0100
committerHéctor Orón Martínez <zumbi@debian.org>2018-11-06 17:39:01 +0100
commit1d3663fc3a861188bbf4343d1ffe5767e9815c57 (patch)
treea6ef971537c9531585a19df1c9849daf192b26ae /actions/raw_action.go
parenta3819b2c8c823955bb053d5a34da27c94aef4d47 (diff)
New upstream version 1.0.0+git20181105.b02e058
Diffstat (limited to 'actions/raw_action.go')
-rw-r--r--actions/raw_action.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/actions/raw_action.go b/actions/raw_action.go
index d3e66fe..af8c31f 100644
--- a/actions/raw_action.go
+++ b/actions/raw_action.go
@@ -116,6 +116,7 @@ func (raw *RawAction) Run(context *debos.DebosContext) error {
if err != nil {
return fmt.Errorf("Failed to open %s: %v", devicePath, err)
}
+ defer target.Close()
offset, err := strconv.ParseInt(raw.Offset, 0, 64)
if err != nil {
@@ -123,7 +124,12 @@ func (raw *RawAction) Run(context *debos.DebosContext) error {
}
bytes, err := target.WriteAt(content, offset)
if bytes != len(content) {
- return errors.New("Couldn't write complete data")
+ return fmt.Errorf("Couldn't write complete data %v", err)
+ }
+
+ err = target.Sync()
+ if err != nil {
+ return fmt.Errorf("Couldn't sync content %v", err)
}
return nil