-
Notifications
You must be signed in to change notification settings - Fork 41
RDKB-63166 : Update device.properties file during runtime #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||
| /* | ||||||
| * If not stated otherwise in this file or this component's Licenses.txt file the | ||||||
|
Check failure on line 2 in source/scripts/init/src/apply_system_defaults/apply_system_defaults.c
|
||||||
| * following copyright and licenses apply: | ||||||
| * | ||||||
| * Copyright 2015 RDK Management | ||||||
|
|
@@ -60,6 +60,7 @@ | |||||
| #include "safec_lib_common.h" | ||||||
|
|
||||||
| #include <telemetry_busmessage_sender.h> | ||||||
|
|
||||||
| #define PARTNERS_INFO_FILE "/nvram/partners_defaults.json" | ||||||
| #define PARTNERS_INFO_FILE_ETC "/etc/partners_defaults.json" | ||||||
| #define BOOTSTRAP_INFO_FILE "/opt/secure/bootstrap.json" | ||||||
|
|
@@ -3317,6 +3318,41 @@ | |||||
| } | ||||||
| #endif | ||||||
|
|
||||||
| #define DEV_PROP_FILE "/etc/device.properties" | ||||||
| static int addPartnerDefaultsToDevPropFile() | ||||||
|
||||||
| { | ||||||
| FILE *fp = NULL; | ||||||
| const char *is_bci = "IS_BCI=yes\n"; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we keep this in some kind of array and have a generic runner logic to add the paramaters in array. |
||||||
| //open to check for existence | ||||||
| fp = fopen(DEV_PROP_FILE, "r"); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we modify with access call? |
||||||
| if (fp == NULL) | ||||||
| { | ||||||
| APPLY_PRINT("[Utopia - %s]File %s does not exist or cannot be accessed",__FUNCTION__,DEV_PROP_FILE); | ||||||
| return 1; | ||||||
| } | ||||||
| fclose(fp); // we don't need it anymore | ||||||
|
|
||||||
| //open for writing | ||||||
| fp = fopen(DEV_PROP_FILE, "a"); | ||||||
|
Comment on lines
+3327
to
+3336
|
||||||
| if (fp == NULL) | ||||||
| { | ||||||
| APPLY_PRINT("[Utopia - %s]File %s couldnot open for writing",__FUNCTION__,DEV_PROP_FILE); | ||||||
|
||||||
| APPLY_PRINT("[Utopia - %s]File %s couldnot open for writing",__FUNCTION__,DEV_PROP_FILE); | |
| APPLY_PRINT("[Utopia - %s]File %s could not open for writing",__FUNCTION__,DEV_PROP_FILE); |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function unconditionally appends "IS_BCI=yes" to the file every time it's called, without checking if the entry already exists. This will result in duplicate entries if the program runs multiple times or if the entry is already present. Before appending, check if "IS_BCI" already exists in the file to prevent duplicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please bring this under ONESTACK_PRODUCT_REQ
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return value of addPartnerDefaultsToDevPropFile() is not checked. If the function fails to write to the file (returns 1), the error is silently ignored. Consider checking the return value and logging an appropriate error message, similar to how other function calls in this section handle errors (see line 3563-3565).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The macro DEV_PROP_FILE is defined locally within the function scope when it should be defined at file scope with other macros (near lines 64-66). This placement is inconsistent with the established pattern in the codebase where file path macros are defined at the top of the file.